가 다시 연결 ..IOException이 자바에서 memcached와의 설정 작업에
코드 :
public class Memcache implements Serializable {
MemcachedClient client;
public static final int EXP_TIME = 10;
public static final String KEY = "spoon";
public static void main(String[] args)throws IOException{
Memcache temp=new Memcache();
Dummy dummy= new Dummy("Hello World");
try {
temp.client = new MemcachedClient(new InetSocketAddress("localhost", 11211));
} catch (IOException e) {
e.printStackTrace();
System.err.println("connection problem");
}
temp.obj=temp.client.getAvailableServers();
System.out.println(temp.obj);
temp.obj1=temp.client.getUnavailableServers();
System.out.println(temp.obj1);
temp.client.add(KEY, EXP_TIME, dummy);
Object myObject=temp.client.get(KEY);
System.out.println(myObject);
temp.client.delete(KEY);
}
}
코드를 디버깅했지만 설정 작업에 도달했을 때 IOException n disconnected가 발생했습니다. 더미에 대한
코드는 다음과 같습니다
import java.io.Serializable;
public class Dummy implements Serializable {
String one;
public Dummy(String one){
this.one=one;
}
}
스택 트레이스는 다음과 같습니다
2012-06-15 14:30:19.259 INFO net.spy.memcached.MemcachedConnection: Added {QA sa=/10.2.200.104:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue 2012-06-15 14:30:19.274 INFO net.spy.memcached.MemcachedConnection: Connection state changed for [email protected] [/10.2.200.104:11211] [] 2012-06-15 14:30:22.852 INFO net.spy.memcached.MemcachedConnection: Reconnecting due to exception on {QA sa=/10.2.200.104:11211, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: set Key: spoon Flags: 1 Exp: 10 Data Length: 76, topWop=null, toWrite=0, interested=1} java.io.IOException: Disconnected unexpected, will reconnect. at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:452) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:380) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:242) at net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:833) 2012-06-15 14:30:22.852 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=/10.2.200.104:11211, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: set Key: spoon Flags: 1 Exp: 10 Data Length: 76, topWop=null, toWrite=0, interested=1}, attempt 0. 2012-06-15 14:30:22.852 WARN net.spy.memcached.protocol.ascii.AsciiMemcachedNodeImpl: Discarding partially completed op: Cmd: set Key: spoon Flags: 1 Exp: 10 Data Length: 76 2012-06-15 14:30:24.868 INFO net.spy.memcached.MemcachedConnection: Reconnecting {QA sa=/10.2.200.104:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} 2012-06-15 14:30:24.868 INFO net.spy.memcached.MemcachedConnection: Connection state changed for [email protected] 2012-06-15 14:30:31.665 INFO net.spy.memcached.MemcachedConnection: Reconnecting due to exception on {QA sa=/10.2.200.104:11211, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: get Keys: spoon Exp: 0, topWop=null, toWrite=0, interested=1} java.io.IOException: Disconnected unexpected, will reconnect. at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:452) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:380) at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:242) at net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:833) 2012-06-15 14:30:31.665 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=/10.2.200.104:11211, #Rops=1, #Wops=0, #iq=0, topRop=Cmd: get Keys: spoon Exp: 0, topWop=null, toWrite=0, interested=1}, attempt 0. 2012-06-15 14:30:31.665 WARN net.spy.memcached.protocol.ascii.AsciiMemcachedNodeImpl: Discarding partially completed op: Cmd: get Keys: spoon Exp: 0 2012-06-15 14:30:33.680 INFO net.spy.memcached.MemcachedConnection: Reconnecting {QA sa=/10.2.200.104:11211, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} 2012-06-15 14:30:33.680 INFO net.spy.memcached.MemcachedConnection: Connection state changed for [email protected] Exception in thread "main" java.lang.RuntimeException: Exception waiting for value at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1001) at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1018) at ballydev.Memcache.main(Memcache.java:39) Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Cancelled at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:103) at net.spy.memcached.internal.GetFuture.get(GetFuture.java:62) at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:997) ... 2 more Caused by: java.lang.RuntimeException: Cancelled ... 5 more
여분의 스택 트레이스가 있습니까? – adarshr
질문 업데이트 –
방화벽/바이러스 백신 문제처럼 보입니다. 비활성화하십시오. – adarshr