public void resume() throws Exception { for (int i = 0; i < wEnv.getHandlerCount(); i++) { if (wEnv.getHandler(i) != null) { wEnv.getHandler(i).resume(); } } }
private void guessHome() { String home = wEnv.getJkHome(); if (home != null) return; home = IntrospectionUtils.guessInstall("jk2.home", "jk2.home", "tomcat-jk2.jar", CNAME); if (home != null) { log.info("Guessed home " + home); wEnv.setJkHome(home); } }
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(); } } } }
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); } } } }
private JkHandler newHandler(String type, String localName, String fullName) { JkHandler handler; String classN = modules.getProperty(type); if (classN == null) { log.error("No class name for " + fullName + " " + type); return null; } try { Class channelclass = Class.forName(classN); handler = (JkHandler) channelclass.newInstance(); } catch (Throwable ex) { handler = null; log.error("Can't create " + fullName, ex); return null; } if (this.domain != null) { try { ObjectName handlerOname = new ObjectName(this.domain + ":" + "type=JkHandler,name=" + fullName); Registry.getRegistry(null, null).registerComponent(handler, handlerOname, classN); } catch (Exception e) { log.error("Error registering " + fullName, e); } } wEnv.addHandler(fullName, handler); return handler; }
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); }