/** * Create a StackObjectPool. * * @return a new StackObjectPool with the configured factory, maxIdle and initial capacity settings */ public ObjectPool<T> createPool() { return new StackObjectPool<T>(_factory,_maxSleeping,_initCapacity); }
public ObjectPool createPool() { return new StackObjectPool(_factory,_maxSleeping,_initCapacity); }
/** * Create a StackObjectPool. * * @return a new StackObjectPool with the configured factory, maxIdle and initial capacity settings */ public ObjectPool<T> createPool() { return new StackObjectPool<T>(_factory,_maxSleeping,_initCapacity); }
public void init() { clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override public Object makeObject() throws Exception { return new RemoteAuthorizationManagerClient(); } }); }
/** * Create a StackObjectPool. * * @return a new StackObjectPool with the configured factory, maxIdle and initial capacity settings */ public ObjectPool<T> createPool() { return new StackObjectPool<T>(_factory,_maxSleeping,_initCapacity); }
public ObjectPool createPool() { return new StackObjectPool(_factory,_maxSleeping,_initCapacity); }
private ThriftKeyValidatorClientPool() { log.debug("Initializing thrift key validator client pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override public Object makeObject() throws Exception { log.debug("Initializing new ThriftKeyValidatorClient instance"); return new ThriftKeyValidatorClient(); } }, 50, 20); }
private APIKeyValidatorClientPool() { log.debug("Initializing WebApp key validator client pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override public Object makeObject() throws Exception { log.debug("Initializing new APIKeyValidatorClient instance"); return new APIKeyValidatorClient(); } }, 50, 20); }
private SubscriberKeyMgtClientPool() { log.debug("Initializing API Key Management Client Pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override public Object makeObject() throws Exception { log.debug("Initializing new SubscriberKeyMgtClient instance"); return new SubscriberKeyMgtClient(serverURL, username, password); } }, 20, 5); }
/** * Initialize the static part of the class.<p> * * @param config the combined configuration of "opencms.properties" and the "persistence.xml" */ public static void init(CmsParameterConfiguration config) { if (!m_isInitialized) { m_isInitialized = true; String connProps = buildConnectionPropertiesValue(config, CmsDbPool.OPENCMS_DEFAULT_POOL_NAME); Properties systemProps = System.getProperties(); systemProps.setProperty(CmsPersistenceUnitConfiguration.ATTR_CONNECTION_PROPERTIES, connProps); m_persistenceFactory = Persistence.createEntityManagerFactory(JPA_PERSISTENCE_UNIT, systemProps); m_factoryTable.put(JPA_PERSISTENCE_UNIT, m_persistenceFactory); CmsPoolEntityManagerFactory entityMan = new CmsPoolEntityManagerFactory(m_persistenceFactory); int entityManagerPoolSize = config.getInteger( CmsDbPool.KEY_DATABASE_POOL + "." + CmsDbPool.OPENCMS_DEFAULT_POOL_NAME + "." + CmsDbPool.KEY_ENTITY_MANAGER_POOL_SIZE, DEFAULT_ENTITY_MANAGER_POOL_SIZE); m_openCmsEmPool = new StackObjectPool(entityMan, entityManagerPoolSize, 0); } }
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 { 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); }
private ThriftKeyValidatorClientPool() { String maxIdleClients = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration().getFirstProperty ("APIKeyValidator.ConnectionPool.MaxIdle"); String initIdleCapacity = ServiceReferenceHolder.getInstance().getAPIManagerConfiguration().getFirstProperty ("APIKeyValidator.ConnectionPool.InitIdleCapacity"); if (StringUtils.isNotEmpty(maxIdleClients)) { maxIdle = Integer.parseInt(maxIdleClients); } else { maxIdle = 50; } int initIdleCapSize; if (StringUtils.isNotEmpty(initIdleCapacity)) { initIdleCapSize = Integer.parseInt(initIdleCapacity); } else { initIdleCapSize = 20; } log.debug("Initializing thrift key validator client pool"); clientPool = new StackObjectPool(new BasePoolableObjectFactory() { @Override public Object makeObject() throws Exception { log.debug("Initializing new ThriftKeyValidatorClient instance"); return new ThriftKeyValidatorClient(); } }, maxIdle, initIdleCapSize); }
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 public Object makeObject() throws Exception { if(log.isDebugEnabled()) { log.debug("Initializing new ThrottleDataPublisher instance"); } return new DataProcessAndPublishingAgent(); } }, dataPublisherPoolConfiguration.getMaxIdle(), dataPublisherPoolConfiguration.getInitIdleCapacity()); }