Пример #1
0
 public void resume() throws Exception {
   for (int i = 0; i < wEnv.getHandlerCount(); i++) {
     if (wEnv.getHandler(i) != null) {
       wEnv.getHandler(i).resume();
     }
   }
 }
Пример #2
0
  public void start() throws IOException {
    long t1 = System.currentTimeMillis();
    // We must have at least 3 handlers:
    // channel is the 'transport'
    // request is the request processor or 'global' chain
    // container is the 'provider'
    // Additional handlers may exist and be used internally
    // or be chained to create one of the standard handlers

    String handlers[] = defaultHandlers;
    // backward compat
    String workers = props.getProperty("handler.list", null);
    if (workers != null) {
      handlers = split(workers, ",");
    }

    // Load additional component declarations
    processModules();

    for (int i = 0; i < handlers.length; i++) {
      String name = handlers[i];
      JkHandler w = getWorkerEnv().getHandler(name);
      if (w == null) {
        newHandler(name, "", name);
      }
    }

    // Process properties - and add aditional handlers.
    processProperties();

    for (int i = 0; i < wEnv.getHandlerCount(); i++) {
      if (wEnv.getHandler(i) != null) {
        try {
          wEnv.getHandler(i).init();
        } catch (IOException ex) {
          if ("apr".equals(wEnv.getHandler(i).getName())) {
            log.info("APR not loaded, disabling jni components: " + ex.toString());
          } else {
            log.error("error initializing " + wEnv.getHandler(i).getName(), ex);
          }
        }
      }
    }

    started = true;
    long t2 = System.currentTimeMillis();
    startTime = t2 - t1;

    this.saveProperties();
    log.info(
        "Jk running ID="
            + wEnv.getLocalId()
            + " time="
            + initTime
            + "/"
            + startTime
            + "  config="
            + propFile);
  }
Пример #3
0
 public void pause() throws Exception {
   // wEnv sometime null at shutdown - bug45591
   if (wEnv != null) {
     for (int i = 0; i < wEnv.getHandlerCount(); i++) {
       if (wEnv.getHandler(i) != null) {
         wEnv.getHandler(i).pause();
       }
     }
   }
 }
Пример #4
0
  public void stop() {
    // Clean up the handlers
    MBeanServer s = Registry.getRegistry(null, null).getMBeanServer();
    for (int i = 0; i < wEnv.getHandlerCount(); i++) {
      JkHandler handler = wEnv.getHandler(i);
      if (handler != null) {
        String handlerName = handler.getName();
        try {
          handler.destroy();
        } catch (IOException ex) {
          log.error("Error stopping " + handlerName, ex);
        }
        if (domain != null) {
          try {
            ObjectName handlerOname =
                new ObjectName(this.domain + ":" + "type=JkHandler,name=" + handlerName);
            if (s.isRegistered(handlerOname)) {
              s.unregisterMBean(handlerOname);
            }
          } catch (Exception e) {
            log.error("Error unregistering " + handlerName, e);
          }
        }
      }
    }

    started = false;

    // De-register JMX for Env
    if (domain != null) {
      try {
        ObjectName wEnvName = new ObjectName(domain + ":type=JkWorkerEnv");
        if (s.isRegistered(wEnvName)) {
          s.unregisterMBean(wEnvName);
        }
      } catch (Exception e) {
        log.error("Error unregistering JkWorkerEnv", e);
      }
    }

    // De-register JMX for JkMain
    if (oname != null) {
      if (s.isRegistered(oname)) {
        try {
          Registry.getRegistry(null, null).unregisterComponent(oname);
        } catch (Exception e) {
          log.error("Error unregistering jkmain " + e);
        }
      }
    }
  }