Catch and log I/O exceptions thrown by #close() and #shutdown() methods

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@989328 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2010-08-25 19:57:51 +00:00
parent 29a4612386
commit 30eb471da7
1 changed files with 15 additions and 9 deletions

View File

@ -146,20 +146,26 @@ public class DefaultClientConnection extends SocketHttpClientConnection
*/
@Override
public void shutdown() throws IOException {
log.debug("Connection shut down");
shutdown = true;
super.shutdown();
Socket sock = this.socket; // copy volatile attribute
if (sock != null)
sock.close();
try {
super.shutdown();
log.debug("Connection shut down");
Socket sock = this.socket; // copy volatile attribute
if (sock != null)
sock.close();
} catch (IOException ex) {
log.debug("I/O error shutting down connection", ex);
}
}
@Override
public void close() throws IOException {
log.debug("Connection closed");
super.close();
try {
super.close();
log.debug("Connection closed");
} catch (IOException ex) {
log.debug("I/O error closing connection", ex);
}
}
@Override