publicvoidprocessConnection(TcpConnection connection,
Object thData[]) {
Socket socket=null;
Http11Processor processor=null;try{
processor=(Http11Processor)thData[Http11BaseProtocol.THREAD_DATA_PROCESSOR];if(processorinstanceofActionHook) {
((ActionHook) processor).action(ActionCode.ACTION_START,null);
}
socket=connection.getSocket();
InputStream in=socket.getInputStream();
OutputStream out=socket.getOutputStream();if( proto.secure ) {
SSLSupport sslSupport=null;if(proto.sslImplementation!=null)
sslSupport=proto.sslImplementation.getSSLSupport(socket);
processor.setSSLSupport(sslSupport);
}else{
processor.setSSLSupport(null);
}
processor.setSocket( socket );
processor.process(in, out);//If unread input arrives after the shutdownInput() call//below and before or during the socket.close(), an error//may be reported to the client. To help troubleshoot this//type of error, provide a configurable delay to give the//unread input time to arrive so it can be successfully read//and discarded by shutdownInput().if( proto.socketCloseDelay>=0) {try{
Thread.sleep(proto.socketCloseDelay);
}catch(InterruptedException ie) {/*ignore*/}
}
TcpConnection.shutdownInput( socket );
}catch(java.net.SocketException e) {//SocketExceptions are normalHttp11BaseProtocol.log.debug
(sm.getString
("http11protocol.proto.socketexception.debug"), e);
}catch(IOException e) {//IOExceptions are normalHttp11BaseProtocol.log.debug
(sm.getString
("http11protocol.proto.ioexception.debug"), e);
}//Future developers: if you discover any other//rare-but-nonfatal exceptions, catch them here, and log as//above.catch(Throwable e) {//any other exception or error is odd. Here we log it//with "ERROR" level, so it will show up even on//less-than-verbose logs.Http11BaseProtocol.log.error
(sm.getString("http11protocol.proto.error"), e);
}finally{//if(proto.adapter != null) proto.adapter.recycle();//processor.recycle();if(processorinstanceofActionHook) {
((ActionHook) processor).action(ActionCode.ACTION_STOP,null);
}//recycle kernel sockets ASAPtry{if(socket!=null) socket.close (); }catch(IOException e) {/*ignore*/}
}
}
}