Examples of GenericObjectPool


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

    private URIResolver uriResolver;

    public XsltTransformer()
    {
        super();
        transformerPool = new GenericObjectPool(new PooledXsltTransformerFactory());
        transformerPool.setMinIdle(MIN_IDLE_TRANSFORMERS);
        transformerPool.setMaxIdle(MAX_IDLE_TRANSFORMERS);
        transformerPool.setMaxActive(MAX_ACTIVE_TRANSFORMERS);
        uriResolver = new LocalURIResolver();
        contextProperties = new HashMap();
View Full Code Here

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

        }
    }

    protected synchronized ObjectPool getClientPool(ImmutableEndpoint endpoint)
    {
        GenericObjectPool pool = pools.get(endpoint.getEndpointURI());

        if (pool == null)
        {
            if (logger.isDebugEnabled())
            {
                logger.debug("Pool is null - creating one for endpoint " + endpoint.getEndpointURI()
                             + " with max size " + getMaxConnectionPoolSize());
            }
            pool = new GenericObjectPool(new SftpConnectionFactory(endpoint), getMaxConnectionPoolSize());
            pool.setTestOnBorrow(isValidateConnections());
            pools.put(endpoint.getEndpointURI(), pool);
        }
        else
        {
            if (logger.isDebugEnabled())
            {
                logger.debug("Using existing pool for endpoint " + endpoint.getEndpointURI() + ". Active: "
                             + pool.getNumActive() + ", Idle:" + pool.getNumIdle());
            }
        }

        return pool;
    }
View Full Code Here

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

    {
        FtpConnector c = (FtpConnector)muleContext.getRegistry().lookupConnector("receiverFtpConnector");
        assertNotNull(c);
       
        MuleEndpointURI uri = new MuleEndpointURI("http://localhost", null);
        GenericObjectPool objectPool = (GenericObjectPool) c.getFtpPool(uri);
        assertEquals(GenericObjectPool.WHEN_EXHAUSTED_FAIL, objectPool.getWhenExhaustedAction());
    }
View Full Code Here

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

            try
            {
                FtpConnectionFactory connectionFactory =
                        (FtpConnectionFactory) ClassUtils.instanciateClass(getConnectionFactoryClass(),
                                                                            new Object[] {uri}, getClass());
                GenericObjectPool genericPool = createPool(connectionFactory);
                pools.put(key, genericPool);
                pool = genericPool;
            }
            catch (Exception ex)
            {
View Full Code Here

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

        return pool;
    }

    protected GenericObjectPool createPool(FtpConnectionFactory connectionFactory)
    {
        GenericObjectPool genericPool = new GenericObjectPool(connectionFactory);
        byte poolExhaustedAction = ThreadingProfile.DEFAULT_POOL_EXHAUST_ACTION;

        ThreadingProfile receiverThreadingProfile = this.getReceiverThreadingProfile();
        if (receiverThreadingProfile != null)
        {
            int threadingProfilePoolExhaustedAction = receiverThreadingProfile.getPoolExhaustedAction();
            if (threadingProfilePoolExhaustedAction == ThreadingProfile.WHEN_EXHAUSTED_WAIT)
            {
                poolExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
            }
            else if (threadingProfilePoolExhaustedAction == ThreadingProfile.WHEN_EXHAUSTED_ABORT)
            {
                poolExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_FAIL;
            }
            else if (threadingProfilePoolExhaustedAction == ThreadingProfile.WHEN_EXHAUSTED_RUN)
            {
                poolExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
            }
        }

        genericPool.setWhenExhaustedAction(poolExhaustedAction);
        genericPool.setTestOnBorrow(isValidateConnections());
        return genericPool;
    }
View Full Code Here

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

        ConnectionFactory connectionFactory)
    {
        ObjectPool connectionPool = mapConnectKeyToPool.get(key);
        if (connectionPool == null) {
            // use GenericObjectPool, which provides for resource limits
            connectionPool = new GenericObjectPool(
                null, // PoolableObjectFactory, can be null
                50, // max active
                GenericObjectPool.WHEN_EXHAUSTED_BLOCK, // action when exhausted
                3000, // max wait (milli seconds)
                10, // max idle
View Full Code Here

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

   
    // Create RemoteDelivery object factory used in pool
    GenericPoolableRemoteDeliveryFactory remoteDeliveryObjectFactory = new GenericPoolableRemoteDeliveryFactory();
   
    // Create pool
    remoteDeliveryObjectPool = new GenericObjectPool(
        remoteDeliveryObjectFactory,
        gopConf
    );
   
    // Initialize object factory of pool
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.pool2.impl.GenericObjectPool

    this.address = address;
    this.connectionInfo = connectionInfo;
    JedisFactory factory = new JedisFactory(address.getHost(), address.getPort(), connectionInfo.getTimeout(),
        connectionInfo.getPassword(), connectionInfo.getDatabase());

    internalPool = new GenericObjectPool(factory, config);
  }
View Full Code Here

Examples of org.apache.tomcat.dbcp.pool.impl.GenericObjectPool

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

    connectionPool.setMinIdle(minIdle);
    connectionPool.setMaxActive(maxActive);

    ConnectionManager._pool = connectionPool;
    // we keep it for two reasons
    // #1 We need it for statistics/debugging
    // #2 PoolingDataSource does not have getPool()
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.