public PondLife get(int timeoutMs)
        throws Exception
    {
        PondLife pl=null;
        
        // Defer to other threads before locking 
        if (_available<_min)
            Thread.yield();
        
        int new_id=-1;
        
        // Try to get pondlife without creating new one.
        synchronized(this)
        {
            // Wait if none available.
            if (_running>0 && _available==0 && _size==_pondLife.length && timeoutMs>0)
                wait(timeoutMs);

            // If still running
            if (_running>0)
            {
                // if pondlife available
                if (_available>0)
                {
                    int id=_index[--_available];
                    pl=_pondLife[id];
                }
                else if (_size<_pondLife.length)
                {
                    // Reserve spot for a new one
                    new_id=reservePondLife(false);
                }
            }

            // create reserved pondlife
            if (pl==null && new_id>=0)
                pl=newPondLife(new_id);
        }

        return pl;
    }
public PondLife get ( int timeoutMs ) throws Exception { PondLife pl = null ; if ( _available < _min ) Thread . yield ( ) ; int new_id = - 1 ; synchronized ( this ) { if ( _running > 0 && _available == 0 && _size == _pondLife . length && timeoutMs > 0 ) wait ( timeoutMs ) ; if ( _running > 0 ) { if ( _available > 0 ) { int id = _index [ -- _available ] ; pl = _pondLife [ id ] ; } else if ( _size < _pondLife . length ) { new_id = reservePondLife ( false ) ; } } if ( pl == null && new_id >= 0 ) pl = newPondLife ( new_id ) ; } return pl ; }
/* ------------------------------------------------------------