コード例 #1
0
 @Override
 public void close() throws IOException {
   try {
     super.close();
     if (log.isDebugEnabled()) {
       log.debug("Connection " + this + " closed");
     }
   } catch (final IOException ex) {
     log.debug("I/O error closing connection", ex);
   }
 }
コード例 #2
0
 @Override
 public void sendRequestHeader(final HttpRequest request) throws HttpException, IOException {
   if (log.isDebugEnabled()) {
     log.debug("Sending request: " + request.getRequestLine());
   }
   super.sendRequestHeader(request);
   if (headerLog.isDebugEnabled()) {
     headerLog.debug(">> " + request.getRequestLine().toString());
     final Header[] headers = request.getAllHeaders();
     for (final Header header : headers) {
       headerLog.debug(">> " + header.toString());
     }
   }
 }
コード例 #3
0
 /**
  * Force-closes this connection. If the connection is still in the process of being open (the
  * method {@link #opening opening} was already called but {@link #openCompleted openCompleted} was
  * not), the associated socket that is being connected to a remote address will be closed. That
  * will interrupt a thread that is blocked on connecting the socket. If the connection is not yet
  * open, this will prevent the connection from being opened.
  *
  * @throws IOException in case of a problem
  */
 @Override
 public void shutdown() throws IOException {
   shutdown = true;
   try {
     super.shutdown();
     if (log.isDebugEnabled()) {
       log.debug("Connection " + this + " shut down");
     }
     final Socket sock = this.socket; // copy volatile attribute
     if (sock != null) {
       sock.close();
     }
   } catch (final IOException ex) {
     log.debug("I/O error shutting down connection", ex);
   }
 }