2014-10-03 366 views
4

这是什么原因?什么原因导致com.aerospike.client.AerospikeException:java.io.EOFException?

com.aerospike.client.AerospikeException: java.io.EOFException 
    at com.aerospike.client.async.SelectorManager.processKey(SelectorManager.java:184) [aerospike-client-3.0.24.jar:?] 
    at com.aerospike.client.async.SelectorManager.runCommands(SelectorManager.java:108) [aerospike-client-3.0.24.jar:?] 
    at com.aerospike.client.async.SelectorManager.run(SelectorManager.java:69) [aerospike-client-3.0.24.jar:?] 
Caused by: java.io.EOFException 
    at com.aerospike.client.async.AsyncConnection.read(AsyncConnection.java:127) ~[aerospike-client-3.0.24.jar:?] 
    at com.aerospike.client.async.AsyncSingleCommand.read(AsyncSingleCommand.java:48) ~[aerospike-client-3.0.24.jar:?] 
    at com.aerospike.client.async.SelectorManager.processKey(SelectorManager.java:164) ~[aerospike-client-3.0.24.jar:?] 
    ... 2 more 
+2

没有任何导致异常的代码,这也可能是一个修辞问题。 – 2014-10-03 18:19:34

+0

这个问题针对的是aerospike的实现者 - 不是一般的java问题。如果你能拿掉你对这个问题的投票权,我会很感激。 – andersonbd1 2014-10-03 18:22:46

+2

然后,您应该先阅读发布StackOverflow的准则并编辑您的问题以符合规则。无论你的问题是关于一般的Java函数还是一个库,你都不能问“为什么我得到这个异常?”如果你不会告诉我们你在做什么导致它。 – 2014-10-04 18:42:03

回答

6

当套接字连接不再有效时引发EOFException。通常会发生这种情况,因为服务器已关闭连接。

/** 
* Read till byteBuffer limit reached or received would-block. 
*/ 
public boolean read(ByteBuffer byteBuffer) throws IOException { 
    while (byteBuffer.hasRemaining()) { 
     int len = socketChannel.read(byteBuffer); 

     if (len == 0) {   
      // Got would-block. 
      return false; 
     } 

     if (len < 0) { 
      // Server has shutdown socket. 
       throw new EOFException(); 
     } 
    } 
    return true; 
} 
+2

关于关闭连接的更多细节EOFException可以在以下Aerospike讨论主题中找到 - https://discuss.aerospike.com/t/what-c​​auses-aerospikeexception-java-io-eofexception/444/12 – 2016-10-20 14:26:48

相关问题