/** * Create a new GenericKeyedObjectPool with the currently configured properties. * * @return GenericKeyedObjectPool with {@link GenericKeyedObjectPool.Config Configuration} determined by * current property settings */ public KeyedObjectPool<K, V> createPool() { return new GenericKeyedObjectPool<K, V>(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_maxTotal,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_lifo); }
public static KeyedObjectPool<JmxConnectionProvider, JMXConnection> createPool() { return new GenericKeyedObjectPool<>(new MBeanServerConnectionFactory()); }
@Override public void init() { NettyPoolableFactory keyPoolableFactory = new NettyPoolableFactory(this); nettyClientKeyPool = new GenericKeyedObjectPool(keyPoolableFactory); nettyClientKeyPool.setConfig(getNettyPoolConfig()); serviceManager = new ServiceManagerStaticConfigImpl(); super.init(); }
private <K, V> GenericKeyedObjectPool<K, V> getObjectPool(KeyedPoolableObjectFactory<K, V> factory, String poolName, long maxWaitMillis) { GenericKeyedObjectPool<K, V> pool = new GenericKeyedObjectPool<>(factory); pool.setTestOnBorrow(true); pool.setMaxActive(-1); pool.setMaxIdle(-1); pool.setTimeBetweenEvictionRunsMillis(MILLISECONDS.convert(5, MINUTES)); pool.setMinEvictableIdleTimeMillis(MILLISECONDS.convert(5, MINUTES)); pool.setMaxWait(maxWaitMillis); pool.setTestOnReturn(true); pool.setTestOnBorrow(true); try { ManagedGenericKeyedObjectPool mbean = new ManagedGenericKeyedObjectPool( pool, poolName); ManagementFactory.getPlatformMBeanServer() .registerMBean(mbean, mbean.getObjectName()); } catch (Exception e) { log.error("Could not register mbean for pool [{}]", poolName, e); } return pool; }
@Override public void start() throws LifecycleException { try { pool = new GenericKeyedObjectPool<>(new DatagramSocketFactory()); pool.setTestOnBorrow(true); pool.setMaxActive(-1); pool.setMaxIdle(-1); pool.setTimeBetweenEvictionRunsMillis(MILLISECONDS.convert(5, MINUTES)); pool.setMinEvictableIdleTimeMillis(MILLISECONDS.convert(5, MINUTES)); this.mbean = new ManagedGenericKeyedObjectPool((GenericKeyedObjectPool) pool, "StatsdConnectionPool"); ManagementFactory.getPlatformMBeanServer() .registerMBean(this.mbean, this.mbean.getObjectName()); } catch (Exception e) { throw new LifecycleException(e); } }
config.maxWait = 10000; StringPoolableObjectFactory objFactory = new StringPoolableObjectFactory(); final KeyedObjectPool pool = new GenericKeyedObjectPool(objFactory, config); PerformanceTest test = new PerformanceTest() {
/** * Create a new GenericKeyedObjectPool with the currently configured properties. * * @return GenericKeyedObjectPool with {@link GenericKeyedObjectPool.Config Configuration} determined by * current property settings */ public KeyedObjectPool<K, V> createPool() { return new GenericKeyedObjectPool<K, V>(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_maxTotal,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_lifo); }
/** * Create a new GenericKeyedObjectPool with the currently configured properties. * * @return GenericKeyedObjectPool with {@link GenericKeyedObjectPool.Config Configuration} determined by * current property settings */ public KeyedObjectPool<K, V> createPool() { return new GenericKeyedObjectPool<K, V>(_factory,_maxActive,_whenExhaustedAction,_maxWait,_maxIdle,_maxTotal,_minIdle,_testOnBorrow,_testOnReturn,_timeBetweenEvictionRunsMillis,_numTestsPerEvictionRun,_minEvictableIdleTimeMillis,_testWhileIdle,_lifo); }
@Inject public ProtoRpcRaftClientProvider(@Nonnull RpcClient client) { RpcChannelFactory channelFactory = new RpcChannelFactory(client); this.connectionPools = new GenericKeyedObjectPool<>(channelFactory, config); }
/** * Creates a new pooling context source, setting up the DirContext object * factory and generic keyed object pool. */ public PoolingContextSource() { this.dirContextPoolableObjectFactory = new DirContextPoolableObjectFactory(); this.keyedObjectPool = new GenericKeyedObjectPool(); this.keyedObjectPool.setFactory(this.dirContextPoolableObjectFactory); }
/** * Creates a new pooling context source, setting up the DirContext object * factory and generic keyed object pool. */ public PoolingContextSource() { this.dirContextPoolableObjectFactory = new DirContextPoolableObjectFactory(); this.keyedObjectPool = new GenericKeyedObjectPool(); this.keyedObjectPool.setFactory(this.dirContextPoolableObjectFactory); }
/** * Creates a new pooling context source, setting up the DirContext object * factory and generic keyed object pool. */ public PoolingContextSource() { this.dirContextPoolableObjectFactory = new DirContextPoolableObjectFactory(); this.keyedObjectPool = new GenericKeyedObjectPool(); this.keyedObjectPool.setFactory(this.dirContextPoolableObjectFactory); }
public DefaultConfigurableKeyedObjectPool() { pool = new GenericKeyedObjectPool(); // NOTE: testOnBorrow MUST be FALSE. this is a bit of a design bug in // commons-pool since validate is used for both activation and passivation, // but has no way of knowing which way it is going. pool.setTestOnBorrow(false); pool.setTestOnReturn(true); }
/** * Creates a new pooling context source, setting up the DirContext object * factory and generic keyed object pool. */ public PoolingContextSource() { this.dirContextPoolableObjectFactory = new DirContextPoolableObjectFactory(); this.keyedObjectPool = new GenericKeyedObjectPool(); this.keyedObjectPool.setFactory(this.dirContextPoolableObjectFactory); }
public static KeyedObjectPool<JmxConnectionProvider, JMXConnection> createPool() { return new GenericKeyedObjectPool<>(new MBeanServerConnectionFactory()); }
public DefaultConfigurableKeyedObjectPool() { pool = new GenericKeyedObjectPool(); // NOTE: testOnBorrow MUST be FALSE. this is a bit of a design bug in // commons-pool since validate is used for both activation and passivation, // but has no way of knowing which way it is going. pool.setTestOnBorrow(false); pool.setTestOnReturn(true); }
public RegexpMatcher() { _pool = new GenericKeyedObjectPool(_factory); _pool.setMinEvictableIdleTimeMillis(EVICT_IDLE_TIME); _pool.setTimeBetweenEvictionRunsMillis(SLEEP_TIME); }
public RegexpMatcher() { _pool = new GenericKeyedObjectPool(_factory); _pool.setMinEvictableIdleTimeMillis(EVICT_IDLE_TIME); _pool.setTimeBetweenEvictionRunsMillis(SLEEP_TIME); }
@Override public void init() { NettyPoolableFactory keyPoolableFactory = new NettyPoolableFactory(this); nettyClientKeyPool = new GenericKeyedObjectPool(keyPoolableFactory); nettyClientKeyPool.setConfig(getNettyPoolConfig()); serviceManager = new ServiceManagerStaticConfigImpl(); super.init(); }
public void initialise() { GenericKeyedObjectPool.Config config = new GenericKeyedObjectPool.Config(); if (connectionPoolingProfile!= null) { config.maxIdle = connectionPoolingProfile.getMaxIdle(); config.maxActive = connectionPoolingProfile.getMaxActive(); config.maxWait = connectionPoolingProfile.getMaxWait(); config.whenExhaustedAction = ((byte) connectionPoolingProfile.getExhaustedAction()); config.timeBetweenEvictionRunsMillis = connectionPoolingProfile.getEvictionCheckIntervalMillis(); config.minEvictableIdleTimeMillis = connectionPoolingProfile.getMinEvictionMillis(); } connectionPool = new GenericKeyedObjectPool(new TimeTrackingModuleConnectionFactory(this), config); if (retryPolicyTemplate == null) { retryPolicyTemplate = muleContext.getRegistry().lookupObject(MuleProperties.OBJECT_DEFAULT_RETRY_POLICY_TEMPLATE); } }