我对memcache真的很陌生。我刚刚在java中测试了memcached。java类构建成功,但是当我运行该文件时,它继续运行永远不会停止。
我使用的代码是......
public class NewMem {
public static void main(String[] args) throws IOException, URISyntaxException{
try {
MemcachedClient client = new MemcachedClient(new InetSocketAddress("localhost", 11211));
} catch (IOException e) {
e.printStackTrace();
System.err.println("connection problem");
}
}
}
当我运行此代码时,它会给出以下内容并且运行不会停止..
init:
deps-jar:
compile-single:
run-single:
2011-11-21 12:15:58.328 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=/localhost:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2011-11-21 12:15:58.328 INFO net.spy.memcached.MemcachedConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@1c5c1
最佳答案
您可能需要调用 shutdown method对于 memcached 客户端:
client.shutdown();
关于java - 在java中使用memcached,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8208236/