我正在休息调用IBM Cloud BPM.有时调用工作正常.但有时它会给出以下错误.
java.io.IOException: An existing connection was forcibly closed by the remote host.
java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我解决这个问题.
任何帮助是极大的赞赏.
cur*_*rd0 10
如果您使用的HTTP客户端打开与服务器的持久连接,并且服务器偶尔会终止它们,则可以解释此类行为.
通常,每次响应后都会关闭与HTTP服务器的连接.使用HTTP" keep-alive ",您可以保持底层TCP连接处于打开状态,直到满足某些条件.这些条件取决于服务器,服务器可以在任意超时或请求数量之后自由关闭连接(只要它返回对当前请求的响应).
当服务器关闭这样的连接时,客户端通常会再次重新打开它,并且根据实现,可能会抛出异常或打印警告.
例如,Vert.x HttpClient(默认情况下打开持久连接)也会抛出......
Run Code Online (Sandbox Code Playgroud)java.io.IOException: An existing connection was forcibly closed by the remote host
...当服务器终止它们时.