本文整理汇总了Java中com.danga.MemCached.SockIOPool.setMaintSleep方法的典型用法代码示例。如果您正苦于以下问题:Java SockIOPool.setMaintSleep方法的具体用法?Java SockIOPool.setMaintSleep怎么用?Java SockIOPool.setMaintSleep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.danga.MemCached.SockIOPool
的用法示例。
在下文中一共展示了SockIOPool.setMaintSleep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import com.danga.MemCached.SockIOPool; //导入方法依赖的package包/类
public void afterPropertiesSet() throws Exception {
client = new MemCachedClient();
// grab an instance of our connection pool
SockIOPool pool = SockIOPool.getInstance();
// set the servers and the weights
pool.setServers(servers);
pool.setWeights(weights);
// set some basic pool settings
// 5 initial, 5 min, and 250 max conns
// and set the max idle time for a conn
// to 6 hours
pool.setInitConn(5);
pool.setMinConn(5);
pool.setMaxConn(250);
pool.setMaxIdle(1000 * 60 * 60 * 6);
// set the sleep for the maint thread
// it will wake up every x seconds and
// maintain the pool size
pool.setMaintSleep(30);
// set some TCP settings
// disable nagle
// set the read timeout to 3 secs
// and don't set a connect timeout
pool.setNagle(false);
pool.setSocketTO(3000);
pool.setSocketConnectTO(0);
// initialize the connection pool
pool.initialize();
// lets set some compression on for the client
// compress anything larger than 64k
client.setCompressEnable(true);
client.setCompressThreshold(64 * 1024);
}