Examples of GenericObjectPool


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

                            return beanFactory.getBean(id);
                        }
                    };
                    //
                    // create a ObjectPool with PoolableObjectFactory created before
                    pool = new GenericObjectPool(pooleableFactory,
                            maxCapacity,
                            GenericObjectPool.WHEN_EXHAUSTED_BLOCK,
                            /*block indefinitely*/-1);
                }
            }
View Full Code Here

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

   * @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

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

                {
                    // logout and close object content manager and session
                    ((ObjectContentManagerImpl)obj).logout();
                }
            };
            ocmPool = new GenericObjectPool(sessionFactory, 0, GenericObjectPool.WHEN_EXHAUSTED_GROW, 0, 5);
            ocmPool.setTimeBetweenEvictionRunsMillis(60000);
            ocmPool.setMinEvictableIdleTimeMillis(300000);
           
            // initialize persistent store
            if (initializeStore)
View Full Code Here

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

    Properties jdbcProps = repoContext.getConnectionProperties();

    ConnectionFactory connFactory =
        new DriverManagerConnectionFactory(connectUrl, jdbcProps);

    connectionPool = new GenericObjectPool();
    connectionPool.setMaxActive(repoContext.getMaximumConnections());

    statementPool = new GenericKeyedObjectPoolFactory(null);

    // creating the factor automatically wires the connection pool
View Full Code Here

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

        try {
            Class.forName(driver);
        } catch (ClassNotFoundException ignore) {
        }

        GenericObjectPool connectionPool = new GenericObjectPool(null);
        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
                url, user, pass);
        PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(
                connectionFactory, connectionPool, null, null, false, true);
View Full Code Here

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

   * @throws Exception
   *             Error occurred when parsing properties to create the
   *             connection factory
   */
  private GenericObjectPool createGenericConnectionFactory(Config config) throws Exception {
    GenericObjectPool poolConnection = new GenericObjectPool();

    String maxPool = config.getProperty(RDBMS.MAX_POOL_SIZE);
    String maxIdle = config.getProperty(RDBMS.MAX_IDLE);
    String minPool = config.getProperty(RDBMS.MIN_POOL_SIZE);
    String maxWait = config.getProperty(RDBMS.MAX_WAIT);
    String testOnReturn = config.getProperty(RDBMS.TEST_ON_RETURN);
    String testOnBorrow = config.getProperty(RDBMS.TEST_ON_BORROW);
    String testWhileIdle = config.getProperty(RDBMS.TEST_WHILE_IDLE);
    String timeBetweenEvictionRunsMillis = config.getProperty(
        RDBMS.TIME_BETWEEN_EVICTION_RUNS_MILLS);
    String numTestsPerEvictionRun = config.getProperty(RDBMS.NUM_TESTS_PER_EVICTION_RUN);
    String minEvictableIdleTimeMillis = config.getProperty(
        RDBMS.MIN_EVICTABLE_IDLE_TIME_MILLIS);

    int minPoolSize = DBConstants.DEFAULT_DBCP_MIN_POOL_SIZE;
    int maxPoolSize = DBConstants.DEFAULT_DBCP_MAX_POOL_SIZE;
    try {
      if (!DBUtils.isEmptyString(maxPool)) {
        maxPoolSize = Integer.valueOf(maxPool).intValue();
        poolConnection.setMaxActive(maxPoolSize);
      }
      if (!DBUtils.isEmptyString(minPool)) {
        minPoolSize = Integer.valueOf(minPool).intValue();
        poolConnection.setMinIdle(minPoolSize);
      }
      int maxPoolIdle = poolConnection.getMaxIdle();
      if (!DBUtils.isEmptyString(maxIdle)) {
        maxPoolIdle = Integer.valueOf(maxIdle).intValue();
        poolConnection.setMaxIdle(maxPoolIdle);
      }
      if (!DBUtils.isEmptyString(maxWait)) {
        int maxPoolWait = Integer.valueOf(maxWait).intValue();
        poolConnection.setMaxWait(maxPoolWait);
      }
      if (!DBUtils.isEmptyString(testOnBorrow)) {
        poolConnection.setTestOnBorrow(Boolean.parseBoolean(testOnBorrow));
      }
      if (!DBUtils.isEmptyString(testOnReturn)) {
        poolConnection.setTestOnReturn(Boolean.parseBoolean(testOnReturn));
      }
      if (!DBUtils.isEmptyString(testWhileIdle)) {
        poolConnection.setTestWhileIdle(Boolean.parseBoolean(testWhileIdle));
      }
      if (!DBUtils.isEmptyString(timeBetweenEvictionRunsMillis)) {
        long timeBetweenPoolEvictionRunsMillis = Long
            .valueOf(timeBetweenEvictionRunsMillis).longValue();
        poolConnection.setTimeBetweenEvictionRunsMillis(timeBetweenPoolEvictionRunsMillis);
      }
      if (!DBUtils.isEmptyString(numTestsPerEvictionRun)) {
        int numTestsPerPoolEvictionRun = Integer.valueOf(numTestsPerEvictionRun).intValue();
        poolConnection.setNumTestsPerEvictionRun(numTestsPerPoolEvictionRun);
      }
      if (!DBUtils.isEmptyString(minEvictableIdleTimeMillis)) {
        long minPoolEvictableIdleTimeMillis = Long.valueOf(minEvictableIdleTimeMillis)
            .longValue();
        poolConnection.setMinEvictableIdleTimeMillis(minPoolEvictableIdleTimeMillis);
      }
      return poolConnection;
    } catch (NumberFormatException e) {
      log.error("Non-numeric value found for numeric pool configuration property", e);
      throw e;
View Full Code Here

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

     */
    public static ObjectPool createConnectionPool(String uri,
            Properties properties) {
        // Create an ObjectPool that will serve as the actual pool of
        // connections
        ObjectPool result = new GenericObjectPool(null);

        // Create a ConnectionFactory that the pool will use to create
        // Connections
        ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
                uri, properties);
View Full Code Here

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

  private XAConnection connection;
  private ObjectPool sessionPool;

  public XASessionPool(final XAConnection connection)
  {
    this(connection, new GenericObjectPool(null, -1));
  }
View Full Code Here

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

            config.maxActive = poolingProfile.getMaxActive();
            config.maxWait = poolingProfile.getMaxWait();
            config.whenExhaustedAction = (byte) poolingProfile.getExhaustedAction();
        }

        pool = new GenericObjectPool(getPooledObjectFactory(), config);

        try
        {
            applyInitialisationPolicy();
        }
View Full Code Here

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

    protected Configuration configuration;

    public XQueryTransformer()
    {
        super();
        transformerPool = new GenericObjectPool(new PooledXQueryTransformerFactory());
        transformerPool.setMinIdle(MIN_IDLE_TRANSFORMERS);
        transformerPool.setMaxIdle(MAX_IDLE_TRANSFORMERS);
        transformerPool.setMaxActive(MAX_ACTIVE_TRANSFORMERS);

        registerSourceType(DataTypeFactory.STRING);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.