我正在尝试用 Java 编写一个简单的代码来连接到 memcache 服务器。我使用 spymemcached 2.8 jar,但出现“服务器重新连接”错误,我无法理解。
代码是:
**client = new MemcachedClient(new BinaryConnectionFactory(),AddrUtil.getAddresses("127.0.0.1:11211"));
} 捕捉(IOException e){
e.printStackTrace();
System.err.println("连接问题");
}
client.set("someKey", 3600, new Integer(10));
对象 myObject=temp.client.get("someKey");
System.out.println(myObject);
client.delete("someKey");**
但我收到的错误是:
**2012-06-14 17:58:31.412 信息 net.spy.memcached.MemcachedConnection:添加 {QA sa=/127.0.0.1:11211,#Rops=0,#Wops=0,#iq=0,topRop= null, topWop=null, toWrite=0, Interest=0} 连接队列
2012-06-14 17:58:31.428 INFO net.spy.memcached.MemcachedConnection:sun.nio.ch.SelectionKeyImpl@1621e42 的连接状态已更改
2012-06-14 17:58:31.428 INFO net.spy.memcached.MemcachedConnection:由于 {QA sa=/127.0.0.1:11211, #Rops=1, #Wops=0, #iq=0, topRop=Cmd:1 不透明:1 密钥:someKey Cas:0 Exp:3600 标志:512 数据长度:1,topWop=null,toWrite=0,interests=1}
java.io.IOException:意外断开连接,将重新连接。
在 net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:452)
在 net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:380)
在 net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:242)
在 net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:833)
2012-06-14 17:58:31.428 警告 net.spy.memcached.MemcachedConnection:关闭并重新打开 {QA sa=/127.0.0.1:11211,#Rops=1,#Wops=0,#iq=1,topRop =Cmd:1 不透明:1 密钥:someKey Cas:0 Exp:3600 标志:512 数据长度:1,topWop=null,toWrite=0,interested=1},尝试 0。
2012-06-14 17:58:31.428 WARN net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl:丢弃部分完成的操作:Cmd:1 不透明:1 键:someKey Cas:0 Exp:3600 标志:512 数据长度:1
2012-06-14 17:58:31.444 警告 net.spy.memcached.MemcachedConnection:无法重新分配到另一个节点,正在重试主节点的 someKey。
2012-06-14 17:58:33.444 信息 net.spy.memcached.MemcachedConnection:重新连接 {QA sa=/127.0.0.1:11211,#Rops=0,#Wops=1,#iq=0,topRop=null, topWop=Cmd:0 不透明:3 键:someKey,toWrite=0,interested=0}
2012-06-14 17:58:33.444 信息 net.spy.memcached.MemcachedConnection:sun.nio.ch.SelectionKeyImpl@1813fac 的连接状态已更改
线程“主”net.spy.memcached.OperationTimeoutException 中的异常:等待值超时
在 net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1003)
在 net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1018)
在 ballydev.Memcache.main(Memcache.java:29)
原因:net.spy.memcached.internal.CheckedOperationTimeoutException:等待操作超时 - 失败节点:/127.0.0.1:11211
在 net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:93)
在 net.spy.memcached.internal.GetFuture.get(GetFuture.java:62)
在 net.spy.memcached.MemcachedClient.get(MemcachedClient.java:997)
... 2 更多**
任何人有任何想法或建议?.. 请回复...