目前,我有一个具有高吞吐量的应用程序,并且正在使用Apache自己提供的httpClient 4.3.3。我有一个问题,过一阵子我一直收到InterruptedIOException。原因是ConnectionShutdownException。我想知道是否有人对此有何见解。
我已跟踪到CPoolProxy第135行中引发了错误。由于用于创建CPoolEntry的poolEntry为null的事实,似乎getConnection()调用失败。
现在,我确实有一个线程来清理过期的线程,并为连接/套接字设置了超时连接和超时。我现在很茫然。这是堆栈跟踪:
06-20 21:45:01.424: W/System.err(22978): java.io.InterruptedIOException: Connection has been shut down
06-20 21:45:01.424: W/System.err(22978): at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:337)
06-20 21:45:01.424: W/System.err(22978): at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
06-20 21:45:01.424: W/System.err(22978): at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
06-20 21:45:01.424: W/System.err(22978): at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
06-20 21:45:01.424: W/System.err(22978): at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186)
06-20 21:45:01.424: W/System.err(22978): at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
06-20 21:45:01.424: W/System.err(22978): at com.loopj.android.http.core.AsyncHttpRequest.makeRequest(AsyncHttpRequest.java:98)
06-20 21:45:01.434: W/System.err(22978): at com.loopj.android.http.core.AsyncHttpRequest.run(AsyncHttpRequest.java:68)
06-20 21:45:01.434: W/System.err(22978): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
06-20 21:45:01.434: W/System.err(22978): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
06-20 21:45:01.434: W/System.err(22978): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
06-20 21:45:01.434: W/System.err(22978): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
06-20 21:45:01.434: W/System.err(22978): at java.lang.Thread.run(Thread.java:841)
06-20 21:45:01.434: W/System.err(22978): Caused by: org.apache.http.impl.conn.ConnectionShutdownException
06-20 21:45:01.444: W/System.err(22978): at org.apache.http.impl.conn.CPoolProxy.invoke(CPoolProxy.java:135)
06-20 21:45:01.444: W/System.err(22978): at $Proxy0.getSSLSession(Native Method)
06-20 21:45:01.444: W/System.err(22978): at org.apache.http.impl.client.DefaultUserTokenHandlerHC4.getUserToken(DefaultUserTokenHandlerHC4.java:80)
06-20 21:45:01.444: W/System.err(22978): at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:320)
06-20 21:45:01.444: W/System.err(22978): ... 12 more
除了这种随机打ic之外,其他所有功能都运作良好。它是随机发生的,所有其他呼叫似乎都在继续,好像什么也没有发生
最佳答案
根据本文件
http://docs.oracle.com/javase/7/docs/api/java/io/InterruptedIOException.htmlInterruptedIOException
表示I / O操作已中断。抛出InterruptedIOException异常,表明输入或输出传输已终止,因为执行该输入或输出的线程已中断。字段bytesTransferred
指示在发生中断之前已成功传输了多少字节。