我的基于 JDMK 的应用程序在 com.sun.jdmk.comm.HttpSendSocket 的第 313 行收到间歇性 IOExceptions,我不知道为什么。我从 Javadoc 中了解到的所有信息是,如果在创建输入流时发生 I/O 错误,您将获得 IOException,但我不知道发生了哪种 I/O 错误或为什么会发生。该代码实际上在此错误发生之前和之后都有效。
任何有关如何调试此间歇性问题的提示将不胜感激。
我不想在此处粘贴 HttpSendSocket 的源代码,因为它不属于我,但我知道当抛出 IOException 异常时它正在执行 HttpURLConnection conn.getInputStream() 。
我曾想过尝试创建自己的 HttpSendSocket 版本,并在其中添加诊断信息,但由于它是一个包保护类,所以我不知道怎么做。
下面的堆栈跟踪:
com.sun.jdmk.comm.CommunicationException: java.io.IOException: HTTP request failed
at com.sun.jdmk.comm.HttpSendSocket.readNotify(HttpSendSocket.java:313)
at com.sun.jdmk.comm.HttpSendInputStream.read(HttpSendInputStream.java:95)
at java.io.FilterInputStream.read(FilterInputStream.java:94)
at java.io.PushbackInputStream.read(PushbackInputStream.java:150)
at com.sun.jdmk.comm.GenericHttpConnectorClient.sendHttp(GenericHttpConnectorClient.java:486)
at com.sun.jdmk.comm.GenericHttpConnectorClient.invokeRemoteOperation(GenericHttpConnectorClient.java:2234)
at com.sun.jdmk.comm.GenericHttpConnectorClient.invoke(GenericHttpConnectorClient.java:1366)
正如我所说,任何有用的建议将不胜感激。