Gets object pool.

@return the object pool
185823
public ObjectPool<MemcachedClientIF> getObjectPool() {
        val pool = new GenericObjectPool<MemcachedClientIF>(this);
        pool.setMaxIdle(memcachedProperties.getMaxIdle());
        pool.setMinIdle(memcachedProperties.getMinIdle());
        pool.setMaxTotal(memcachedProperties.getMaxTotal());
        return pool;
    }
964288
public java.util.List<PublicIpv4Pool> getPublicIpv4Pools() {
        if (publicIpv4Pools == null) {
            publicIpv4Pools = new com.amazonaws.internal.SdkInternalList<PublicIpv4Pool>();
        }
        return publicIpv4Pools;
    }
628419
public E borrowObject() throws Exception
    {
        assertOpen();
        long starttime = System.currentTimeMillis();
        for (; ;)
        {

            E obj = null;

            // if there are any sleeping, just grab one of those
            synchronized (this)
            {
                obj = pool.remove();

                // otherwise
                if (null == obj)
                {
                    // check if we can create one
                    // (note we know that the num sleeping is 0, else we wouldn't be here)
                    if (maxActive < 0 || numActive < maxActive)
                    {
                        // allow new object to be created
                    }
                    else
                    {
                        // the pool is exhausted
                        switch (whenExhaustedAction)
                        {
                            case WHEN_EXHAUSTED_GROW:
                                // allow new object to be created
                                break;
                            case WHEN_EXHAUSTED_FAIL:
                                throw new NoSuchElementException("Pool exhausted");
                            case WHEN_EXHAUSTED_BLOCK:
                                try
                                {
                                    if (maxWait <= 0)
                                    {
                                        wait();
                                    }
                                    else
                                    {
                                        // this code may be executed again after a notify then continue cycle
                                        // so, need to calculate the amount of time to wait
                                        final long elapsed = (System.currentTimeMillis() - starttime);
                                        final long waitTime = maxWait - elapsed;
                                        if (waitTime > 0)
                                        {
                                            wait(waitTime);
                                        }
                                    }
                                }
                                catch (InterruptedException e)
                                {
                                    Thread.currentThread().interrupt();
                                    throw e;
                                }
                                if (maxWait > 0 && ((System.currentTimeMillis() - starttime) >= maxWait))
                                {
                                    throw new NoSuchElementException("Timeout waiting for idle object");
                                }
                                else
                                {
                                    continue; // keep looping
                                }
                            default:
                                throw new IllegalArgumentException("WhenExhaustedAction property " + whenExhaustedAction + " not recognized.");
                        }
                    }
                }
                numActive++;
            }

            // create new object when needed
            boolean newlyCreated = false;
            if (null == obj)
            {
                try
                {
                    obj = factory.makeObject(this);
                    newlyCreated = true;
                    return obj;
                }
                finally
                {
                    if (!newlyCreated)
                    {
                        // object cannot be created
                        synchronized (this)
                        {
                            numActive--;
                            notifyAll();
                        }
                    }
                }
            }

            // activate & validate the object
            try
            {
                factory.activateObject(obj);
                if (testOnBorrow && !factory.validateObject(obj))
                {
                    throw new Exception("ValidateObject failed");
                }
                return obj;
            }
            catch (Throwable e)
            {
                reportException("object activation or validation failed ", e);
                synchronized (this)
                {
                    // object cannot be activated or is invalid
                    numActive--;
                    notifyAll();
                }
                destroyObject(obj);
                if (newlyCreated)
                {
                    throw new NoSuchElementException("Could not create a validated object, cause: " + e.getMessage());
                }
                // keep looping
            }
        }
    }
1189452
private GenericKeyedObjectPool createPool()
    {
        GenericKeyedObjectPool.Config conf = poolConfig.getKeyedObjectPoolConfig();
        if (log.isDebugEnabled())
            log.debug("PersistenceBroker pool will be setup with the following configuration " +
                    ToStringBuilder.reflectionToString(conf, ToStringStyle.MULTI_LINE_STYLE));
        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(null, conf);
        pool.setFactory(new PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory(this, pool));
        return pool;
    }
794170
function getObject() {
    return objectPool.pop() || {
      'array': null,
      'cache': null,
      'criteria': null,
      'false': false,
      'index': 0,
      'null': false,
      'number': null,
      'object': null,
      'push': null,
      'string': null,
      'true': false,
      'undefined': false,
      'value': null
    };
  }
655830
@Nonnull
    StringBuilder get() {
        if( pool.size() == 0 ) {
            return new StringBuilder();
        } else {
            StringBuilder builder = pool.pollLast();
            builder.setLength( 0 );
            return builder;
        }
    }
692101
public Object get()
        throws InterruptedException
    {
        synchronized(lock)
        {
            while (size==0)
                lock.wait();
            
            Object o = elements[head];
            elements[head]=null;
            if(++head==maxSize)
                head=0;
            if (size==maxSize)
                lock.notifyAll();
            size--;
            return o;
        }
    }
873496
public function get()
	{
		// if at least an item is available in the pool
		if ( count($this->_poolItems) )
			$item = array_pop($this->_poolItems);
		
		// otherwise, we create a new instance
		else
			$item = call_user_func_array($this->_factorymethod, $this->_factorymethodparams);

		// now in use
		$this->_inUseItems[] = $item;
		
		// initialize item
		if ( $this->_initmethod )
			$item->{$this->_initmethod}();
			
		return $item;
	}
544665
protected Object[] purge() {
        Object[] data = new Object[getCurrentNumElements()];
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "LocalPool is purging " + data.length + " items.  firstEntry: " + firstEntry + " lastEntry: " + lastEntry + " poolSize: " + poolSize);
        }

        if (0 < data.length) {
            int out = 0;
            if (lastEntry >= firstEntry) {
                for (int i = firstEntry; i <= lastEntry; i++) {
                    data[out] = free[i];
                    free[i] = null;
                    out++;
                }
            } else {
                for (int i = firstEntry; i < poolSize; i++) {
                    data[out] = free[i];
                    free[i] = null;
                    out++;
                }
                for (int i = 0; i <= lastEntry; i++) {
                    data[out] = free[i];
                    free[i] = null;
                    out++;
                }
            }

            lastEntry = -1;
            firstEntry = -1;
        }

        return data;
    }
788785
public Iterator iterator()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass,
                        "iterator");

        Iterator iterator = subList(null, null).iterator();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass,
                       "iterator",
                       new Object[] { iterator });
        return iterator;
    }
9086
protected ObjectManagerByteArrayOutputStream[] getBuffers()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        "getBuffers");

        ObjectManagerByteArrayOutputStream[] buffers = new ObjectManagerByteArrayOutputStream[1];

        // Create the buffer to contain the header for this log record.
        buffers[0] = new ObjectManagerByteArrayOutputStream(overhead);

        buffers[0].writeInt(LogRecord.TYPE_PADDING);
        buffers[0].writeInt(totalSize - overhead);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       "getBuffers",
                       new Object[] { buffers }
                            );
        return buffers;
    }
315742
def pool(self):
        
        if self._pool is None:
            self._pool = ThreadPool(self.pool_threads)
        return self._pool
785026
protected List<File> getSpooledFileList()
    {
        final List<File> spooledFileList = new ArrayList<File>();

        for (final File file : spoolDirectory.listFiles()) {
            if (file.isFile()) {
                spooledFileList.add(file);
            }
        }

        return spooledFileList;
    }
1313797
protected T getObject() {
		final T object;
		if (reusedObject != null) {
			// REUSE THE SAME RECORD AFTER HAVING RESETTED IT
			object = reusedObject;
			object.reset();
		} else
			// CREATE A NEW ONE
			object = (T) database.newInstance(className);
		return object;
	}
193685
public synchronized T borrow() throws JMSException
	{
		if (closed)
			throw new ObjectPoolException("Object pool is closed");
		
		// Object immediately available ?
		int availableCount = available.size();
		if (availableCount > 0)
			return available.remove(availableCount-1);
		
		// Can we create one more ?
		if (all.size() < maxSize)
			return extendPool();
		
		// Pool is exhausted
		switch (exhaustionPolicy)
		{
			case WHEN_EXHAUSTED_FAIL  : throw new ObjectPoolException("Pool is exhausted (maxSize="+maxSize+")");
			case WHEN_EXHAUSTED_BLOCK : return waitForAvailability();
			case WHEN_EXHAUSTED_WAIT  : return waitForAvailability(waitTimeout,true);
			case WHEN_EXHAUSTED_RETURN_NULL : return null;
			case WHEN_EXHAUSTED_WAIT_RETURN_NULL : return waitForAvailability(waitTimeout,false);
			
			default:
				throw new ObjectPoolException("Invalid exhaustion policy : "+exhaustionPolicy);
		}
	}
550905
public T get() {
        T object;

        while (true) {
            // 1. get the next free object
            int p = m_put.get();
            int g = m_get.get();
            if (g >= p) {
                // get index hits the put index, implying empty pool
                if (p >= LIMIT) {
                    // put pointer wrapped around. rewind both indexes.
                    m_get.set(0);
                    m_put.set(0);
                }
                return null;
            }

            // 2. conquer this cell by incrementing the get index
            if (!m_get.compareAndSet(g, g + 1)) {
                // some other thread got here first. try again.
                continue;
            }

            // 3. retrieve the object at the get index
            int index = g % m_arraySize;
            AtomicReference<T> reference = m_array[index];
            object = reference.get();
            if (object == null) {
                // getting here is rare. it happens when:
                // 1. put() is called on an empty pool (p==g)
                // 2. put() increments the put pointer (p==g+1)
                // 3. get() is called and finds g < p
                // 4. get() takes the object at g (which is null)
                // 5. put() puts the object at g
                continue;
            }

            // 4. change the reference to null so no other get() takes the
            // same element, and no other put() replaces it with another.
            if (reference.compareAndSet(object, null)) {
                return object;
            }

            // getting here is rare. the object that was supposedly conquered
            // locally was either replaced by a different object or replaced
            // with null, in the same cell.
        }
    }
810257
public final java.util.Iterator getObjectStoreIterator()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass
                        , "getObjectStoreIterator"
                            );
        java.util.Iterator objectStoreIterator = objectManagerState.getObjectStoreIterator();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "getObjectStoreIterator"
                       , new Object[] { objectStoreIterator }
                            );
        return objectStoreIterator;
    }