コード例 #1
1
 protected void unregister(Http11Processor processor) {
   if (proto.getDomain() != null) {
     synchronized (this) {
       try {
         RequestInfo rp = processor.getRequest().getRequestProcessor();
         rp.setGlobalProcessor(null);
         ObjectName rpName = rp.getRpName();
         if (log.isDebugEnabled()) {
           log.debug("Unregister " + rpName);
         }
         Registry.getRegistry(null, null).unregisterComponent(rpName);
         rp.setRpName(null);
       } catch (Exception e) {
         log.warn("Error unregistering request", e);
       }
     }
   }
 }
コード例 #2
0
 protected void register(Http11Processor processor) {
   if (proto.getDomain() != null) {
     synchronized (this) {
       try {
         long count = registerCount.incrementAndGet();
         RequestInfo rp = processor.getRequest().getRequestProcessor();
         rp.setGlobalProcessor(global);
         ObjectName rpName =
             new ObjectName(
                 proto.getDomain()
                     + ":type=RequestProcessor,worker="
                     + proto.getName()
                     + ",name=HttpRequest"
                     + count);
         if (log.isDebugEnabled()) {
           log.debug("Register " + rpName);
         }
         Registry.getRegistry(null, null).registerComponent(rp, rpName, null);
         rp.setRpName(rpName);
       } catch (Exception e) {
         log.warn("Error registering request");
       }
     }
   }
 }
コード例 #3
0
  /**
   * Return the address.
   *
   * @return An address string
   */
  public String getAddress() {
    String hostAddress = null;
    Connector connector = ServerUtil.getDefaultConnector();
    if (connector.getProtocolHandler() instanceof Http11Protocol) {
      Http11Protocol protocol = (Http11Protocol) connector.getProtocolHandler();
      InetAddress address = protocol.getAddress();
      hostAddress = address.getHostAddress();
    } else {
      _log.warn(
          "Unable to determine host address from connector.  Using alias definition instead.");
      hostAddress = ServerUtil.getDefaultHost().getHost().findAliases()[0];
    }

    return connector.getScheme()
        + "://"
        + hostAddress
        + ":"
        + connector.getPort()
        + "/"
        + _contextName;
  }
コード例 #4
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;
    }