Test code
XMemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil.getAddresses(hosts));
builder.getConfiguration().setSessionIdleTimeout(10000);
builder.setCommandFactory(new KestrelCommandFactory());
memcachedClient=builder.build();
memcachedClient.setPrimitiveAsString(true);
memcachedClient.setOptimizeGet(false);
memcachedClient.setOpTimeout(10000);
for(int i=0;i<1;i++){
new Thread(new Runnable() {
@OverRide
public void run() {
//To change body of implemented methods use File | Settings | File Templates.
memcachedClient.get("aaa/t=2000");
}
}).start();
}
for(int i=0;i<1;i++){
new Thread(new Runnable() {
@Override
public void run() {
//To change body of implemented methods use File | Settings | File Templates.
memcachedClient.set("aaab", "asdf");
}
}).start();
}
net.rubyeye.xmemcached.exception.MemcachedDecodeException: Decode error,session will be closed,line=STORED
at net.rubyeye.xmemcached.command.Command.decodeError(Command.java:259)
at net.rubyeye.xmemcached.command.Command.decodeError(Command.java:270)
at net.rubyeye.xmemcached.command.text.TextGetCommand.decode(TextGetCommand.java:126)
at net.rubyeye.xmemcached.codec.MemcachedDecoder.decode0(MemcachedDecoder.java:61)
at net.rubyeye.xmemcached.codec.MemcachedDecoder.decode(MemcachedDecoder.java:56)
at com.google.code.yanf4j.nio.impl.NioTCPSession.decode(NioTCPSession.java:288)
at com.google.code.yanf4j.nio.impl.NioTCPSession.readFromBuffer(NioTCPSession.java:205)
at com.google.code.yanf4j.nio.impl.AbstractNioSession.onRead(AbstractNioSession.java:198)
at com.google.code.yanf4j.nio.impl.AbstractNioSession.onEvent(AbstractNioSession.java:343)
at com.google.code.yanf4j.nio.impl.SocketChannelController.dispatchReadEvent(SocketChannelController.java:56)
at com.google.code.yanf4j.nio.impl.NioController.onRead(NioController.java:157)
at com.google.code.yanf4j.nio.impl.Reactor.dispatchEvent(Reactor.java:294)
at com.google.code.yanf4j.nio.impl.Reactor.run(Reactor.java:141)
but when replace memcachedClient.get("aaa/t=2000"); to memcachedClient.get("aaa"); is ok
I read the source code, i found there is only one session bind to one channel ,the command put to queue ,then sent one by one , but in the first case , getting without response is blocked, setting come back , then fetch the first executing command that is getting ,but response is STORED,so occur error,
This will depend to return the order, but the server can not guarantee first come, first response.
can you explain why to design like that.