Java Code Examples for org.apache.catalina.Context#removeLifecycleListener()

The following examples show how to use org.apache.catalina.Context#removeLifecycleListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HostConfig.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void lifecycleEvent(LifecycleEvent event) {
    if (Lifecycle.AFTER_STOP_EVENT.equals(event.getType())) {
        // The context has stopped.
        Context context = (Context) event.getLifecycle();

        // Remove the old expanded WAR.
        ExpandWar.delete(toDelete);

        // Reset the docBase to trigger re-expansion of the WAR.
        context.setDocBase(newDocBase);

        // Remove this listener from the Context else it will run every
        // time the Context is stopped.
        context.removeLifecycleListener(this);
    }
}
 
Example 2
Source File: HostConfig.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void lifecycleEvent(LifecycleEvent event) {
    if (event.getType() == Lifecycle.AFTER_STOP_EVENT) {
        // The context has stopped.
        Context context = (Context) event.getLifecycle();

        // Remove the old expanded WAR.
        ExpandWar.delete(toDelete);

        // Reset the docBase to trigger re-expansion of the WAR.
        context.setDocBase(newDocBase);

        // Remove this listener from the Context else it will run every
        // time the Context is stopped.
        context.removeLifecycleListener(this);
    }
}
 
Example 3
Source File: ThreadLocalLeakPreventionListener.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
protected void processContainerRemoveChild(Container parent,
    Container child) {

    if (log.isDebugEnabled())
        log.debug("Process removeChild[parent=" + parent + ",child=" +
            child + "]");

    if (child instanceof Context) {
        Context context = (Context) child;
        context.removeLifecycleListener(this);
    } else if (child instanceof Host || child instanceof Engine) {
        child.removeContainerListener(this);
    }
}
 
Example 4
Source File: ThreadLocalLeakPreventionListener.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
protected void processContainerRemoveChild(Container parent,
    Container child) {

    if (log.isDebugEnabled())
        log.debug("Process removeChild[parent=" + parent + ",child=" +
            child + "]");

    if (child instanceof Context) {
        Context context = (Context) child;
        context.removeLifecycleListener(this);
    } else if (child instanceof Host || child instanceof Engine) {
        child.removeContainerListener(this);
    }
}
 
Example 5
Source File: ThreadLocalLeakPreventionListener.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
protected void processContainerRemoveChild(Container parent,
    Container child) {

    if (log.isDebugEnabled())
        log.debug("Process removeChild[parent=" + parent + ",child=" +
            child + "]");

    if (child instanceof Context) {
        Context context = (Context) child;
        context.removeLifecycleListener(this);
    } else if (child instanceof Host || child instanceof Engine) {
        child.removeContainerListener(this);
    }
}