/** * Close the connection. This method calls close on the input and output streams and interrupts * any thread in the handle method. may be specialized to close sockets etc. * * @exception IOException */ public void close() throws IOException { try { _completing = true; if (_connection instanceof Socket && !(_connection instanceof SSLSocket)) ((Socket) _connection).shutdownOutput(); _outputStream.close(); _inputStream.close(); } finally { if (_handlingThread != null && Thread.currentThread() != _handlingThread) _handlingThread.interrupt(); } }
/* ------------------------------------------------------------ */ protected void associateThread() { __threadConnection.set(this); _handlingThread = Thread.currentThread(); }