我是否需要在httpclient中手动关闭inputStream或CloseableHttpResponse?

时间:2019-12-09 11:39:21

标签: java httpclient

httpclient 已经具有 EofSensorInputStream ,它将根据异常或内容长度是否结束( checkEOF )自动关闭。我是否需要再次手动关闭inputStream或CloseableHttpResponse?例如:

  

Blockquote       在org.apache.http.impl.execchain.ConnectionHolder.releaseConnection(ConnectionHolder.java:96)       在   org.apache.http.impl.execchain.ConnectionHolder.releaseConnection(ConnectionHolder.java:120)       在   org.apache.http.impl.execchain.ResponseEntityProxy.releaseConnection(ResponseEntityProxy.java:76)       在   org.apache.http.impl.execchain.ResponseEntityProxy.eofDetected(ResponseEntityProxy.java:122)       在   org.apache.http.conn.EofSensorInputStream.checkEOF(EofSensorInputStream.java:199)       在   org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:136)       在sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)在   sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)在   sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)       -将<0x860>(java.io.InputStreamReader)锁定在java.io.InputStreamReader.read(InputStreamReader.java:184)   java.io.BufferedReader.fill(BufferedReader.java:161)在   java.io.BufferedReader.readLine(BufferedReader.java:324)在   java.io.BufferedReader.readLine(BufferedReader.java:389)在   org.apache.commons.io.IOUtils.readLines(IOUtils.java:1030)在   org.apache.commons.io.IOUtils.readLines(IOUtils.java:987)在   org.apache.commons.io.IOUtils.readLines(IOUtils.java:968)

0 个答案:

没有答案