@Override
public void afterPropertiesSet() throws Exception {
clientPool = new ArrayList<SpyTokyotyrantClient>(poolSize);
for (int i = 0; i < poolSize; i++) {
ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder();
cfb.setFailureMode(FailureMode.Redistribute);
cfb.setDaemon(true);
cfb.setProtocol(Protocol.TEXT);
if (isConsistentHashing) {
cfb.setLocatorType(Locator.CONSISTENT);
cfb.setHashAlg(HashAlgorithm.KETAMA_HASH);
}
cfb.setOpTimeout(operationTimeout);
try {
MemcachedClient spyClient = new MemcachedClient(cfb.build(), AddrUtil.getAddresses(memcachedNodes));
clientPool.add(new SpyTokyotyrantClient(spyClient));
} catch (IOException e) {
logger.error("MemcachedClient initilization error: ", e);
throw e;
}