try { if (Http.DEBUG) { http.logDebug(getName() + ": Processing request on socket: " + socket); }  socket.markInactive();  listener.handleConnection(socket);  keepAlive = supportKeepAlive && !socket.isClosed(); } catch (InterruptedIOException e) {  keepAlive = false;  if (Http.DEBUG) { http.logDebug(getName() + ": Read Timeout while processing connection on socket: " + socket, e); } } catch (SocketException e) {  keepAlive = false;  if (Http.DEBUG) { http.logDebug(getName() + ": Socket Exception while processing connection on socket: " + socket, e); } }      catch (ServletException e) {  keepAlive = false;  http.logWarning(HttpMsg.HTTP_SERVLET_EXCEPTION, e); } catch (IOException e) {  keepAlive = false;  http.logWarning(HttpMsg.HTTP_CONNECTION_EXCEPTION, e); } catch (Throwable t) {  keepAlive = false;  http.logError(HttpMsg.HTTP_CONNECTION_EXCEPTION, t); } finally { if (!keepAlive) { if (!socket.isClosed()) { try { if (Http.DEBUG) { http.logDebug(getName() + ": Closing socket: " + socket); }  socket.close(); } catch (IOException e) {  } }  socket = null; listener = null; } }
if (conn.isClosed()) {	 conn = null;		 }
	public void run() {		running = true;		while (running) {			if (socket == null) {				/*				 synchronized (this)				 {				 pool.putThread(this);				 * Synchronizing on this before putThread				 * causes deadlock when security manager causes				 * Thread.isAlive() calls				 */				pool.putThread(this);				synchronized (this) {					try {						wait();					} catch (InterruptedException e) {						// ignore and check exit condition					}				}			}			if (running && (socket != null)) {				boolean keepAlive = false;				try {					if (Http.DEBUG) {						http.logDebug(getName() + ": Processing request on socket: " + socket); //$NON-NLS-1$					}					socket.markInactive();					listener.handleConnection(socket);					keepAlive = supportKeepAlive && !socket.isClosed();				} catch (InterruptedIOException e) {					/* A read on the socket did not complete within the timeout period.					 */					keepAlive = false;					if (Http.DEBUG) {						http.logDebug(getName() + ": Read Timeout while processing connection on socket: " + socket, e); //$NON-NLS-1$					}				} catch (SocketException e) {					/* Most likely the user agent closed the socket.					 */					keepAlive = false;					if (Http.DEBUG) {						http.logDebug(getName() + ": Socket Exception while processing connection on socket: " + socket, e); //$NON-NLS-1$					}				}				// BUGBUG Need to handle UnavailableException				// Servlet 2.2 Section 3.3.3.2				// BUGBUG An unhandled exception should result in flushing the response				// buff and returning status code 500.				// Servlet 2.3 Section 9.9.2				catch (ServletException e) {					/* The Servlet threw a ServletException.					 */					keepAlive = false;					http.logWarning(HttpMsg.HTTP_SERVLET_EXCEPTION, e);				} catch (IOException e) {					/* The Servlet threw an IOException.					 */					keepAlive = false;					http.logWarning(HttpMsg.HTTP_CONNECTION_EXCEPTION, e);				} catch (Throwable t) {					/* Some exception has occurred. Log it and keep					 * the thread working.					 */					keepAlive = false;					http.logError(HttpMsg.HTTP_CONNECTION_EXCEPTION, t);				} finally {					if (!keepAlive) {						if (!socket.isClosed()) {							try {								if (Http.DEBUG) {									http.logDebug(getName() + ": Closing socket: " + socket); //$NON-NLS-1$								}								socket.close();							} catch (IOException e) {								// TODO: consider logging							}						}						socket = null;						listener = null;					}				}			}		}	}