先看错误信息:
java.lang.NullPointerException
at net.rubyeye.xmemcached.impl.MemcachedTCPSession.destroy(MemcachedTCPSession.java:112)
at net.rubyeye.xmemcached.impl.MemcachedHandler.onSessionClosed(MemcachedHandler.java:136)
at com.google.code.yanf4j.core.impl.AbstractSession.onClosed(AbstractSession.java:305)
at com.google.code.yanf4j.core.impl.AbstractSession.close(AbstractSession.java:293)
at com.google.code.yanf4j.nio.impl.NioTCPSession.decode(NioTCPSession.java:302)
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$ReadTask.run(NioController.java:110)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
看了一下MemcachedTCPSession.destroy方法:
public void destroy() {
Command command = this.currentCommand.get();
if (command != null) {
command.setException(new MemcachedException(
"Session has been closed"));
command.getLatch().countDown();
}
while ((command = this.commandAlreadySent.poll()) != null) {
command.setException(new MemcachedException(
"Session has been closed"));
if (command.getLatch() != null) {
command.getLatch().countDown();
}
}
}
不知为什么第一个command.getLatch().countDown()不判断command.getLatch(
)为null的情况?
出现几次这个异常后,以后的调用会一直抛There is no available
connection at this moment错误。
个人觉得由于这个异常导致MemcachedHandler方法onSessionClosed中的t
his.reconnect(memcachedSession)不能执行,导致session不能重建,不知
对不对?
版本:1.3.5
Original issue reported on code.google.com by zhaodj1...@gmail.com on 29 Aug 2013 at 11:09
Original issue reported on code.google.com by
zhaodj1...@gmail.com
on 29 Aug 2013 at 11:09