Example #1
0
    public boolean process(Socket socket) {
      Http11Processor processor = recycledProcessors.poll();
      try {

        if (processor == null) {
          processor = createProcessor();
        }

        if (processor instanceof ActionHook) {
          ((ActionHook) processor).action(ActionCode.ACTION_START, null);
        }

        if (proto.isSSLEnabled() && (proto.sslImplementation != null)) {
          processor.setSSLSupport(proto.sslImplementation.getSSLSupport(socket));
        } else {
          processor.setSSLSupport(null);
        }

        processor.process(socket);
        return false;

      } catch (java.net.SocketException e) {
        // SocketExceptions are normal
        Http11Protocol.log.debug(sm.getString("http11protocol.proto.socketexception.debug"), e);
      } catch (java.io.IOException e) {
        // IOExceptions are normal
        Http11Protocol.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.
        Http11Protocol.log.error(sm.getString("http11protocol.proto.error"), e);
      } finally {
        //       if(proto.adapter != null) proto.adapter.recycle();
        //                processor.recycle();

        if (processor instanceof ActionHook) {
          ((ActionHook) processor).action(ActionCode.ACTION_STOP, null);
        }
        recycledProcessors.offer(processor);
      }
      return false;
    }