public void init() {
    if (initialized) return;
    initialized = true;

    log = Logger.getLogger(ManagerBase.class);

    StandardContext ctx = (StandardContext) this.getContainer();
    distributable = ctx.getDistributable();
    if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
      if (oname == null) {
        try {
          Engine eng = (Engine) ctx.getParent().getParent();
          domain = ctx.getEngineName();
          StandardHost hst = (StandardHost) ctx.getParent();
          String path = ctx.getPath();
          if (path.equals("")) {
            path = "/";
          }
          oname = new ObjectName(domain + ":type=Manager,path=" + path + ",host=" + hst.getName());
          Registry.getRegistry(null, null).registerComponent(this, oname, null);
        } catch (Exception e) {
          log.error("Error registering ", e);
        }
      }
    }

    if (log.isDebugEnabled()) log.debug("Registering " + oname);
  }
Beispiel #2
0
  public void init() {
    if (initialized) return;
    initialized = true;

    StandardContext ctx = (StandardContext) this.getContainer();
    distributable = ctx.getDistributable();
    if (org.apache.tomcat.util.Constants.ENABLE_MODELER) {
      if (oname == null) {
        try {
          Engine eng = (Engine) ctx.getParent().getParent();
          domain = ctx.getEngineName();
          StandardHost hst = (StandardHost) ctx.getParent();
          String path = ctx.getPath();
          if (path.equals("")) {
            path = "/";
          }
          oname = new ObjectName(domain + ":type=Manager,path=" + path + ",host=" + hst.getName());
          Registry.getRegistry(null, null).registerComponent(this, oname, null);
        } catch (Exception e) {
          CatalinaLogger.SESSION_LOGGER.failedSessionManagerJmxRegistration(oname, e);
        }
      }
    }

    if (CatalinaLogger.SESSION_LOGGER.isDebugEnabled())
      CatalinaLogger.SESSION_LOGGER.debug("Registering " + oname);
  }