Skip to content

Commit

Permalink
Catch and log I/O exceptions thrown by #close() and #shutdown() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ok2c committed Aug 25, 2010
1 parent 3f16806 commit 3b7195c
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,26 @@ public void openCompleted(boolean secure, HttpParams params) throws IOException
*/
@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
Expand Down

0 comments on commit 3b7195c

Please sign in to comment.