Package org.apache.commons.pool.impl

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


                {
                    // 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


                getLogger().log("Setting isolation level '" + levelString + "'", LOG_CHANNEL, Logger.INFO);

                // use DBCP pooling if enabled
                if (useDbcpPooling) {
                    getLogger().log("Using DBCP pooling", LOG_CHANNEL, Logger.INFO);
                    GenericObjectPool connectionPool = new GenericObjectPool(null);
                    if (maxPooledConnections != -1) {
                        connectionPool.setMaxActive(maxPooledConnections);
                    }
                    getLogger().log(
                        "Number of connections set to " + connectionPool.getMaxActive(),
                        LOG_CHANNEL,
                        Logger.INFO);

                    DriverManagerConnectionFactory connectionFactory =
                        new DriverManagerConnectionFactory(url, user, password);
View Full Code Here

    private PoolingDriver driver = null;
   
    public void setUp() throws Exception {
        super.setUp();
        GenericObjectPool pool = new GenericObjectPool(null, getMaxActive(), GenericObjectPool.WHEN_EXHAUSTED_BLOCK, getMaxWait(), 10, true, true, 10000L, 5, 5000L, true);
        DriverConnectionFactory cf = new DriverConnectionFactory(new TesterDriver(),"jdbc:apache:commons:testdriver",null);
        GenericKeyedObjectPoolFactory opf = new GenericKeyedObjectPoolFactory(null, 10, GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK, 2000L, 10, true, true, 10000L, 5, 5000L, true);
        PoolableConnectionFactory pcf = new PoolableConnectionFactory(cf, pool, opf, "SELECT COUNT(*) FROM DUAL", false, true);
        assertNotNull(pcf);
        driver = new PoolingDriver();
View Full Code Here

        DriverManager.deregisterDriver(driver);
    }

    /** @see http://issues.apache.org/bugzilla/show_bug.cgi?id=12400 */
    public void testReportedBug12400() throws Exception {
        ObjectPool connectionPool = new GenericObjectPool(
            null,
            70,
            GenericObjectPool.WHEN_EXHAUSTED_BLOCK,
            60000,
            10);
View Full Code Here

     * connection pool associated with our data source.
     *
     * @exception SQLException if a database error occurs
     */
    public void close() throws SQLException {
        GenericObjectPool oldpool = connectionPool;
        connectionPool = null;
        dataSource = null;
        try {
            if (oldpool != null) {
                oldpool.close();
            }
        } catch(SQLException e) {
            throw e;
        } catch(RuntimeException e) {
            throw e;
View Full Code Here

        // Create an object pool to contain our active connections
        if ((abandonedConfig != null) && (abandonedConfig.getRemoveAbandoned() == true)) {
            connectionPool = new AbandonedObjectPool(null,abandonedConfig);
        }
        else {
            connectionPool = new GenericObjectPool();
        }
        connectionPool.setMaxActive(maxActive);
        connectionPool.setMaxIdle(maxIdle);
        connectionPool.setMinIdle(minIdle);
        connectionPool.setMaxWait(maxWait);
View Full Code Here

        userMax = getPerUserMaxWait(username);
        int maxWait = (userMax == null) ?
            getDefaultMaxWait() : userMax.intValue();

        // Create an object pool to contain our PooledConnections
        GenericObjectPool pool = new GenericObjectPool(null);
        pool.setMaxActive(maxActive);
        pool.setMaxIdle(maxIdle);
        pool.setMaxWait(maxWait);
        pool.setWhenExhaustedAction(whenExhaustedAction(maxActive, maxWait));
        pool.setTestOnBorrow(getTestOnBorrow());
        pool.setTestOnReturn(getTestOnReturn());
        pool.setTimeBetweenEvictionRunsMillis(
            getTimeBetweenEvictionRunsMillis());
        pool.setNumTestsPerEvictionRun(getNumTestsPerEvictionRun());
        pool.setMinEvictableIdleTimeMillis(getMinEvictableIdleTimeMillis());
        pool.setTestWhileIdle(getTestWhileIdle());
               
        // Set up the factory we will use (passing the pool associates
        // the factory with the pool, so we do not have to do so
        // explicitly)
        new CPDSConnectionFactory(cpds, pool, getValidationQuery(),
View Full Code Here

                getLogger().log("Setting isolation level '" + levelString + "'", LOG_CHANNEL, Logger.INFO);

                // use DBCP pooling if enabled
                if (useDbcpPooling) {
                    getLogger().log("Using DBCP pooling", LOG_CHANNEL, Logger.INFO);
                    GenericObjectPool connectionPool = new GenericObjectPool(null);
                    if (maxPooledConnections != -1) {
                        connectionPool.setMaxActive(maxPooledConnections);
                    }
                    getLogger().log(
                        "Number of connections set to " + connectionPool.getMaxActive(),
                        LOG_CHANNEL,
                        Logger.INFO);

                    DriverManagerConnectionFactory connectionFactory =
                        new DriverManagerConnectionFactory(url, user, password);
View Full Code Here

        int defaultTransactionIsolation = config.getTransactionIsolation(
                TRANSACTION_ISOLATION,
                Connection.TRANSACTION_SERIALIZABLE);
        String defaultCatalog = config.getString(CATALOG);

        ObjectPool connectionPool = new GenericObjectPool(null, poolConfig);

        // a side effect of PoolableConnectionFactory constructor call is that newly
        // created factory object is assigned to "connectionPool", which is definitely a
        // very confusing part of DBCP - new object is not visibly assigned to anything,
        // still it is preserved...
View Full Code Here

       
        _defaultContext = Ognl.createDefaultContext(null, _ognlResolver, _typeConverter);
       
        OgnlRuntime.setCompiler(new HiveMindExpressionCompiler(_classFactory));
       
        _contextPool = new GenericObjectPool(new PoolableOgnlContextFactory(_ognlResolver, _typeConverter));

        _contextPool.setMaxActive(-1);
        _contextPool.setMaxIdle(-1);
        _contextPool.setMinEvictableIdleTimeMillis(POOL_MIN_IDLE_TIME);
        _contextPool.setTimeBetweenEvictionRunsMillis(POOL_SLEEP_TIME);
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.