Search in sources :

Example 1 with NettyKeyedPoolClientFactory

use of com.ctrip.xpipe.netty.commands.NettyKeyedPoolClientFactory in project x-pipe by ctripcorp.

the class XpipeNettyClientKeyedObjectPool method doInitialize.

@Override
protected void doInitialize() throws Exception {
    this.pooledObjectFactory = new NettyKeyedPoolClientFactory();
    pooledObjectFactory.start();
    GenericKeyedObjectPool<InetSocketAddress, NettyClient> genericKeyedObjectPool = new GenericKeyedObjectPool<>(pooledObjectFactory, config);
    genericKeyedObjectPool.setTestOnBorrow(true);
    genericKeyedObjectPool.setTestOnCreate(true);
    genericKeyedObjectPool.setSoftMinEvictableIdleTimeMillis(DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
    genericKeyedObjectPool.setMinEvictableIdleTimeMillis(DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS);
    genericKeyedObjectPool.setTimeBetweenEvictionRunsMillis(DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS);
    this.objectPool = genericKeyedObjectPool;
}
Also used : NettyClient(com.ctrip.xpipe.netty.commands.NettyClient) NettyKeyedPoolClientFactory(com.ctrip.xpipe.netty.commands.NettyKeyedPoolClientFactory) GenericKeyedObjectPool(org.apache.commons.pool2.impl.GenericKeyedObjectPool) InetSocketAddress(java.net.InetSocketAddress)

Aggregations

NettyClient (com.ctrip.xpipe.netty.commands.NettyClient)1 NettyKeyedPoolClientFactory (com.ctrip.xpipe.netty.commands.NettyKeyedPoolClientFactory)1 InetSocketAddress (java.net.InetSocketAddress)1 GenericKeyedObjectPool (org.apache.commons.pool2.impl.GenericKeyedObjectPool)1