Java 类org.apache.catalina.util.LifecycleMBeanBase 实例源码

项目:tomcat7    文件:MBeanFactory.java   
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className The fully qualified class name of the {@link Valve} to
 *                  create
 * @param parent    The MBean name of the associated parent
 *                  {@link Container}.
 *
 * @return  The MBean name of the {@link Valve} that was created or
 *          <code>null</code> if the {@link Valve} does not implement
 *          {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent)
        throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:MBeanFactory.java   
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className The fully qualified class name of the {@link Valve} to
 *                  create
 * @param parent    The MBean name of the associated parent
 *                  {@link Container}.
 *
 * @return  The MBean name of the {@link Valve} that was created or
 *          <code>null</code> if the {@link Valve} does not implement
 *          {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent)
        throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
项目:lazycat    文件:MBeanFactory.java   
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className
 *            The fully qualified class name of the {@link Valve} to create
 * @param parent
 *            The MBean name of the associated parent {@link Container}.
 *
 * @return The MBean name of the {@link Valve} that was created or
 *         <code>null</code> if the {@link Valve} does not implement
 *         {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent) throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
项目:class-guard    文件:MBeanFactory.java   
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className The fully qualified class name of the {@link Valve} to
 *                  create
 * @param parent    The MBean name of the associated parent
 *                  {@link Container}.
 *
 * @return  The MBean name of the {@link Valve} that was created or
 *          <code>null</code> if the {@link Valve} does not implement
 *          {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent)
        throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
项目:apache-tomcat-7.0.57    文件:MBeanFactory.java   
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className The fully qualified class name of the {@link Valve} to
 *                  create
 * @param parent    The MBean name of the associated parent
 *                  {@link Container}.
 *
 * @return  The MBean name of the {@link Valve} that was created or
 *          <code>null</code> if the {@link Valve} does not implement
 *          {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent)
        throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
项目:apache-tomcat-7.0.57    文件:MBeanFactory.java   
/**
 * Create a new Valve and associate it with a {@link Container}.
 *
 * @param className The fully qualified class name of the {@link Valve} to
 *                  create
 * @param parent    The MBean name of the associated parent
 *                  {@link Container}.
 *
 * @return  The MBean name of the {@link Valve} that was created or
 *          <code>null</code> if the {@link Valve} does not implement
 *          {@link LifecycleMBeanBase}.
 */
public String createValve(String className, String parent)
        throws Exception {

    // Look for the parent
    ObjectName parentName = new ObjectName(parent);
    Container container = getParentContainerFromParent(parentName);

    if (container == null) {
        // TODO
        throw new IllegalArgumentException();
    }

    Valve valve = (Valve) Class.forName(className).newInstance();

    container.getPipeline().addValve(valve);

    if (valve instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) valve).getObjectName().toString();
    } else {
        return null;
    }
}
项目:tomcat7    文件:NamingResources.java   
@Override
protected String getDomainInternal() {
    // Use the same domain as our associated container if we have one
    Object c = getContainer();

    if (c instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) c).getDomain();
    }

    return null;
}
项目:tomcat7    文件:StandardService.java   
/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {

    super.initInternal();

    if (container != null) {
        container.init();
    }

    // Initialize any Executors
    for (Executor executor : findExecutors()) {
        if (executor instanceof LifecycleMBeanBase) {
            ((LifecycleMBeanBase) executor).setDomain(getDomain());
        }
        executor.init();  // StandardThreadExecutor#initInternal
    }

    // Initialize our defined Connectors
    synchronized (connectorsLock) {
        for (Connector connector : connectors) {
            try {
                connector.init();
            } catch (Exception e) {
                String message = sm.getString(
                        "standardService.connector.initFailed", connector);
                log.error(message, e);

                if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                    throw new LifecycleException(message);
            }
        }
    }
}
项目:apache-tomcat-7.0.73-with-comment    文件:NamingResources.java   
@Override
protected String getDomainInternal() {
    // Use the same domain as our associated container if we have one
    Object c = getContainer();

    if (c instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) c).getDomain();
    }

    return null;
}
项目:apache-tomcat-7.0.73-with-comment    文件:StandardService.java   
/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {

    super.initInternal();

    if (container != null) {
     //初始化容器StandEngine
        container.init();
    }

    // Initialize any Executors
    for (Executor executor : findExecutors()) {
        if (executor instanceof LifecycleMBeanBase) {
            ((LifecycleMBeanBase) executor).setDomain(getDomain());
        }
        executor.init();
    }

    // 等到容器初始化的差不多的时候才去初始化连接器
    // Initialize our defined Connectors
    synchronized (connectorsLock) {
        for (Connector connector : connectors) {
            try {
                //
                connector.init();
            } catch (Exception e) {
                String message = sm.getString(
                        "standardService.connector.initFailed", connector);
                log.error(message, e);

                if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                    throw new LifecycleException(message);
            }
        }
    }
}
项目:lazycat    文件:NamingResources.java   
@Override
protected String getDomainInternal() {
    // Use the same domain as our associated container if we have one
    Object c = getContainer();

    if (c instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) c).getDomain();
    }

    return null;
}
项目:lazycat    文件:StandardService.java   
/**
 * Invoke a pre-startup initialization. This is used to allow connectors to
 * bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {

    super.initInternal();

    if (container != null) {
        container.init();
    }

    // Initialize any Executors
    for (Executor executor : findExecutors()) {
        if (executor instanceof LifecycleMBeanBase) {
            ((LifecycleMBeanBase) executor).setDomain(getDomain());
        }
        executor.init();
    }

    // Initialize our defined Connectors
    synchronized (connectorsLock) {
        for (Connector connector : connectors) {
            try {
                connector.init();
            } catch (Exception e) {
                String message = sm.getString("standardService.connector.initFailed", connector);
                log.error(message, e);

                if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                    throw new LifecycleException(message);
            }
        }
    }
}
项目:class-guard    文件:NamingResources.java   
@Override
protected String getDomainInternal() {
    // Use the same domain as our associated container if we have one
    Object c = getContainer();

    if (c instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) c).getDomain();
    }

    return null;
}
项目:class-guard    文件:StandardService.java   
/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {

    super.initInternal();

    if (container != null) {
        container.init();
    }

    // Initialize any Executors
    for (Executor executor : findExecutors()) {
        if (executor instanceof LifecycleMBeanBase) {
            ((LifecycleMBeanBase) executor).setDomain(getDomain());
        }
        executor.init();
    }

    // Initialize our defined Connectors
    synchronized (connectors) {
        for (Connector connector : connectors) {
            try {
                connector.init();
            } catch (Exception e) {
                String message = sm.getString(
                        "standardService.connector.initFailed", connector);
                log.error(message, e);

                if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                    throw new LifecycleException(message);
            }
        }
    }
}
项目:apache-tomcat-7.0.57    文件:NamingResources.java   
@Override
protected String getDomainInternal() {
    // Use the same domain as our associated container if we have one
    Object c = getContainer();

    if (c instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) c).getDomain();
    }

    return null;
}
项目:apache-tomcat-7.0.57    文件:StandardService.java   
/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {

    super.initInternal();

    if (container != null) {
        //engine容器初始化 tomcat默认server.xml里的<service>元素下是<engine>
        container.init();
    }

    // Initialize any Executors
    for (Executor executor : findExecutors()) {
        if (executor instanceof LifecycleMBeanBase) {
            ((LifecycleMBeanBase) executor).setDomain(getDomain());
        }
        executor.init();
    }

    // Initialize our defined Connectors
    synchronized (connectors) {
        for (Connector connector : connectors) {
            try {
                connector.init();
            } catch (Exception e) {
                String message = sm.getString(
                        "standardService.connector.initFailed", connector);
                log.error(message, e);

                if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                    throw new LifecycleException(message);
            }
        }
    }
}
项目:apache-tomcat-7.0.57    文件:NamingResources.java   
@Override
protected String getDomainInternal() {
    // Use the same domain as our associated container if we have one
    Object c = getContainer();

    if (c instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) c).getDomain();
    }

    return null;
}
项目:apache-tomcat-7.0.57    文件:StandardService.java   
/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {

    super.initInternal();

    if (container != null) {
        //engine容器初始化 tomcat默认server.xml里的<service>元素下是<engine>
        container.init();
    }

    // Initialize any Executors
    for (Executor executor : findExecutors()) {
        if (executor instanceof LifecycleMBeanBase) {
            ((LifecycleMBeanBase) executor).setDomain(getDomain());
        }
        executor.init();
    }

    // Initialize our defined Connectors
    synchronized (connectors) {
        for (Connector connector : connectors) {
            try {
                connector.init();
            } catch (Exception e) {
                String message = sm.getString(
                        "standardService.connector.initFailed", connector);
                log.error(message, e);

                if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                    throw new LifecycleException(message);
            }
        }
    }
}
项目:WBSAirback    文件:NamingResources.java   
@Override
protected String getDomainInternal() {
    // Use the same domain as our associated container if we have one
    Object c = getContainer();

    if (c instanceof LifecycleMBeanBase) {
        return ((LifecycleMBeanBase) c).getDomain();
    }

    return null;
}
项目:WBSAirback    文件:StandardService.java   
/**
 * Invoke a pre-startup initialization. This is used to allow connectors
 * to bind to restricted ports under Unix operating environments.
 */
@Override
protected void initInternal() throws LifecycleException {

    super.initInternal();

    if (container != null) {
        container.init();
    }

    // Initialize any Executors
    for (Executor executor : findExecutors()) {
        if (executor instanceof LifecycleMBeanBase) {
            ((LifecycleMBeanBase) executor).setDomain(getDomain());
        }
        executor.init();
    }

    // Initialize our defined Connectors
    synchronized (connectors) {
        for (Connector connector : connectors) {
            try {
                connector.init();
            } catch (Exception e) {
                String message = sm.getString(
                        "standardService.connector.initFailed", connector);
                log.error(message, e);

                if (Boolean.getBoolean("org.apache.catalina.startup.EXIT_ON_INIT_FAILURE"))
                    throw new LifecycleException(message);
            }
        }
    }
}
项目:tomee    文件:LazyStopStandardRoot.java   
public LazyStopStandardRoot(final WebResourceRoot delegate) {
    this.delegate = delegate;
    this.isJmxEnabled = JmxEnabled.class.isInstance(delegate);
    this.isLifecycleMBeanBase = LifecycleMBeanBase.class.isInstance(delegate);
}
项目:tomee    文件:LazyStopStandardRoot.java   
public void postDeregister() {
    if (isLifecycleMBeanBase) {
        LifecycleMBeanBase.class.cast(delegate).postDeregister();
    }
}
项目:tomee    文件:LazyStopStandardRoot.java   
public void postRegister(final Boolean registrationDone) {
    if (isLifecycleMBeanBase) {
        LifecycleMBeanBase.class.cast(delegate).postRegister(registrationDone);
    }
}
项目:tomee    文件:LazyStopStandardRoot.java   
public void preDeregister() throws Exception {
    if (isLifecycleMBeanBase) {
        LifecycleMBeanBase.class.cast(delegate).preDeregister();
    }
}
项目:tomee    文件:LazyStopStandardRoot.java   
public ObjectName preRegister(final MBeanServer server, final ObjectName name) throws Exception {
    if (isLifecycleMBeanBase) {
        return LifecycleMBeanBase.class.cast(delegate).preRegister(server, name);
    }
    return name;
}