List of usage examples for org.apache.commons.pool BasePoolableObjectFactory BasePoolableObjectFactory
BasePoolableObjectFactory
From source file:org.wso2.carbon.apimgt.gateway.handlers.security.keys.APIKeyValidatorClientPool.java
private APIKeyValidatorClientPool() { String maxIdleClients = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration() .getFirstProperty("APIKeyValidator.ConnectionPool.MaxIdle"); String initIdleCapacity = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration() .getFirstProperty("APIKeyValidator.ConnectionPool.InitIdleCapacity"); int initIdleCapSize; if (StringUtils.isNotEmpty(maxIdleClients)) { maxIdle = Integer.parseInt(maxIdleClients); } else {/*from ww w . j a va 2s . c om*/ maxIdle = 50; } if (StringUtils.isNotEmpty(initIdleCapacity)) { initIdleCapSize = Integer.parseInt(initIdleCapacity); } else { initIdleCapSize = 20; } log.debug("Initializing API key validator client pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override public Object makeObject() throws Exception { log.debug("Initializing new APIKeyValidatorClient instance"); return new APIKeyValidatorClient(); } }, maxIdle, initIdleCapSize); }
From source file:org.wso2.carbon.apimgt.gateway.handlers.security.thrift.ThriftKeyValidatorClientPool.java
private ThriftKeyValidatorClientPool() { log.debug("Initializing thrift key validator client pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override//from ww w .j av a2s . co m public Object makeObject() throws Exception { log.debug("Initializing new ThriftKeyValidatorClient instance"); return new ThriftKeyValidatorClient(); } }, 50, 20); }
From source file:org.wso2.carbon.apimgt.gateway.throttling.publisher.ThrottleDataPublisherPool.java
private ThrottleDataPublisherPool() { //Using stack object pool to handle high concurrency scenarios without droping any messages. //Tuning this pool is mandatory according to use cases. //A finite number of "sleeping" or idle instances is enforced, but when the pool is empty, new instances // are created to support the new load. Hence this following data stricture places no limit on the number of " // active" instance created by the pool, but is quite useful for re-using Objects without introducing // artificial limits. //Proper tuning is mandatory for good performance according to system load. ThrottleProperties.DataPublisherPool dataPublisherPoolConfiguration = ServiceReferenceHolder.getInstance() .getThrottleProperties().getDataPublisherPool(); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override/*from w ww . jav a 2s. co m*/ public Object makeObject() throws Exception { if (log.isDebugEnabled()) { log.debug("Initializing new ThrottleDataPublisher instance"); } return new DataProcessAndPublishingAgent(); } }, dataPublisherPoolConfiguration.getMaxIdle(), dataPublisherPoolConfiguration.getInitIdleCapacity()); }
From source file:org.wso2.carbon.apimgt.impl.utils.AuthorizationManager.java
private void init(final ClientType type) { clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override//ww w . ja va 2 s.co m public Object makeObject() throws Exception { return AuthorizationManagerClientFactory.getAuthorizationManagerClient(type); } }); }
From source file:org.wso2.carbon.apimgt.impl.utils.RemoteAuthorizationManager.java
public void init() { clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override//from ww w.j a v a 2 s . c o m public Object makeObject() throws Exception { return new RemoteAuthorizationManagerClient(); } }); }
From source file:org.wso2.carbon.apimgt.keymgt.client.SubscriberKeyMgtClientPool.java
private SubscriberKeyMgtClientPool() { log.debug("Initializing API Key Management Client Pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override/*from ww w.j a va 2s.c om*/ public Object makeObject() throws Exception { log.debug("Initializing new SubscriberKeyMgtClient instance"); return new SubscriberKeyMgtClient(serverURL, username, password); } }, 20, 5); }
From source file:org.wso2.carbon.appmgt.gateway.handlers.security.keys.APIKeyValidatorClientPool.java
private APIKeyValidatorClientPool() { log.debug("Initializing WebApp key validator client pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override/*from w ww. java 2 s . com*/ public Object makeObject() throws Exception { log.debug("Initializing new APIKeyValidatorClient instance"); return new APIKeyValidatorClient(); } }, 50, 20); }