java MemcachedClient.mutate method never returns

Ray Krueger raykrueger at gmail.com
Wed Mar 19 00:20:21 UTC 2008


In testing the MemcachedClient.incr and decr functions I came across
two problems.

1) The internal mutate method uses latch.await() with no default
timeout, and no way to set a timeout.
2) Using incr never recovers from the instance it was using going down.

Run the following code:
public static void main(String[] args) throws Exception {

	MemcachedClient cache = new
MemcachedClient(AddrUtil.getAddresses("localhost:11211"));

	for (int i=0; i < 1000; i++) {
		cache.incr("test", 1, 1);
		Thread.sleep(100);
	}

	cache.shutdown();

}


While the loop is incrementing shutdown the memcached instance and
bring it back up. The client will never reconnect, maybe because it's
blocked on the latch.await()?


More information about the memcached mailing list