@SuppressWarnings("rawtypes")
protected void prepareClient() {
// grab an instance of our connection pool
SockIOPool pool = null;
if (StringUtils.isBlank(getPoolName())) {
pool = SockIOPool.getInstance();
mcc = new MemCachedClient();
} else {
pool = SockIOPool.getInstance(getPoolName());
mcc = new MemCachedClient(getPoolName());
}
// Integer[] weights = { 5, 1 };
// 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(getInitConn());
pool.setMinConn(getMinConn());
pool.setMaxConn(getMaxConn());
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);
// pool.setBufferSize(1024);
// 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(getConnectTimeout());
// initialize the connection pool
pool.initialize();
// lets set some compression on for the client
// compress anything larger than 64k
// mcc.setCompressEnable(true);
// mcc.setCompressThreshold(64 * 1024);