Package org.apache.commons.pool.impl

Examples of org.apache.commons.pool.impl.GenericObjectPool$Config


  private final DataSource delegate;
 
  public ConnectionPoolDataSource(DataSource underlyingDataSource) {
    Preconditions.checkNotNull(underlyingDataSource);
    ConnectionFactory connectionFactory = new ConfiguringConnectionFactory(underlyingDataSource);
    GenericObjectPool objectPool = new GenericObjectPool();
    objectPool.setTestOnBorrow(false);
    objectPool.setTestOnReturn(false);
    objectPool.setTestWhileIdle(true);
    objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
    // Constructor actually sets itself as factory on pool
    new PoolableConnectionFactory(connectionFactory, objectPool, null, "SELECT 1", false, false);
    delegate = new PoolingDataSource(objectPool);
  }
View Full Code Here


    private InetAddress localAddress;
    private int localPort;

    public void afterPropertiesSet() throws Exception {
        if (pool == null) {
            pool = new GenericObjectPool();
        }
        pool.setFactory(this);
    }
View Full Code Here

    {
        // First, we'll need a ObjectPool that serves as the
        // actual pool of connections.
        // We'll use a GenericObjectPool instance, although
        // any ObjectPool implementation will suffice.
        ObjectPool connectionPool = new GenericObjectPool( null, maxActive );

        // TODO make configurable
        // By dfault the size is 8!!!!!!!
        ( (GenericObjectPool) connectionPool ).setMaxIdle( -1 );
View Full Code Here

        // actual pool of connections.
        //
        // We'll use a GenericObjectPool instance, although
        // any ObjectPool implementation will suffice.
        //
        ObjectPool connectionPool = new GenericObjectPool(null);

        //
        // Next, we'll create a ConnectionFactory that the
        // pool will use to create Connections.
        // We'll use the DriverManagerConnectionFactory,
View Full Code Here

        // actual pool of connections.
        //
        // We'll use a GenericObjectPool instance, although
        // any ObjectPool implementation will suffice.
        //
        ObjectPool connectionPool = new GenericObjectPool(null);

        //
        // Next, we'll create a ConnectionFactory that the
        // pool will use to create Connections.
        // We'll use the DriverManagerConnectionFactory,
View Full Code Here

   * @return an empty Commons <code>ObjectPool</code>.
   * @see org.apache.commons.pool.impl.GenericObjectPool
   * @see #setMaxSize
   */
  protected ObjectPool createObjectPool() {
    GenericObjectPool gop = new GenericObjectPool(this);
    gop.setMaxActive(getMaxSize());
    gop.setMaxIdle(getMaxIdle());
    gop.setMinIdle(getMinIdle());
    gop.setMaxWait(getMaxWait());
    gop.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionRunsMillis());
    gop.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
    gop.setWhenExhaustedAction(getWhenExhaustedAction());
    return gop;
  }
View Full Code Here

   * @return an empty Commons <code>ObjectPool</code>.
   * @see org.apache.commons.pool.impl.GenericObjectPool
   * @see #setMaxSize
   */
  protected ObjectPool createObjectPool(ListenerSessionManager sessionManager) {
    GenericObjectPool pool = new GenericObjectPool(createPoolableObjectFactory(sessionManager));
    pool.setMaxActive(getMaxSize());
    pool.setMaxIdle(getMaxIdle());
    pool.setMinIdle(getMinIdle());
    pool.setMaxWait(getMaxWait());
    pool.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionRunsMillis());
    pool.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
    return pool;
  }
View Full Code Here

   * @return an empty Commons <code>ObjectPool</code>.
   * @see org.apache.commons.pool.impl.GenericObjectPool
   * @see #setMaxSize
   */
  protected ObjectPool createObjectPool(ListenerSessionManager sessionManager) {
    GenericObjectPool pool = new GenericObjectPool(createPoolableObjectFactory(sessionManager));
    pool.setMaxActive(getMaxSize());
    pool.setMaxIdle(getMaxIdle());
    pool.setMinIdle(getMinIdle());
    pool.setMaxWait(getMaxWait());
    pool.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionRunsMillis());
    pool.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
    return pool;
  }
View Full Code Here

   * @return an empty Commons <code>ObjectPool</code>.
   * @see org.apache.commons.pool.impl.GenericObjectPool
   * @see #setMaxSize
   */
  protected ObjectPool createObjectPool(ListenerSessionManager sessionManager) {
    GenericObjectPool pool = new GenericObjectPool(createPoolableObjectFactory(sessionManager));
    pool.setMaxActive(getMaxSize());
    pool.setMaxIdle(getMaxIdle());
    pool.setMinIdle(getMinIdle());
    pool.setMaxWait(getMaxWait());
    pool.setTimeBetweenEvictionRunsMillis(getTimeBetweenEvictionRunsMillis());
    pool.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
    return pool;
  }
View Full Code Here

  private final DataSource delegate;
 
  public ConnectionPoolDataSource(DataSource underlyingDataSource) {
    Preconditions.checkArgument(underlyingDataSource != null, "underlyingDataSource is null");
    ConnectionFactory connectionFactory = new ConfiguringConnectionFactory(underlyingDataSource);
    GenericObjectPool objectPool = new GenericObjectPool();
    objectPool.setTestOnBorrow(false);
    objectPool.setTestOnReturn(false);
    objectPool.setTestWhileIdle(true);
    objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
    PoolableObjectFactory factory = new PoolableConnectionFactory(connectionFactory, objectPool, null,
      "SELECT 1", false, false);
    objectPool.setFactory(factory);
    delegate = new PoolingDataSource(objectPool);
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.pool.impl.GenericObjectPool$Config

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.