org.apache.catalina.ContainerEvent Java Examples

The following examples show how to use org.apache.catalina.ContainerEvent. 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: ThreadLocalLeakPreventionListener.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
    try {
        String type = event.getType();
        if (Container.ADD_CHILD_EVENT.equals(type)) {
            processContainerAddChild(event.getContainer(),
                (Container) event.getData());
        } else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
            processContainerRemoveChild(event.getContainer(),
                (Container) event.getData());
        }
    } catch (Exception e) {
        String msg =
            sm.getString(
                "threadLocalLeakPreventionListener.containerEvent.error",
                event);
        log.error(msg, e);
    }

}
 
Example #2
Source File: ThreadLocalLeakPreventionListener.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
    try {
        String type = event.getType();
        if (Container.ADD_CHILD_EVENT.equals(type)) {
            processContainerAddChild(event.getContainer(),
                (Container) event.getData());
        } else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
            processContainerRemoveChild(event.getContainer(),
                (Container) event.getData());
        }
    } catch (Exception e) {
        String msg =
            sm.getString(
                "threadLocalLeakPreventionListener.containerEvent.error",
                event);
        log.error(msg, e);
    }

}
 
Example #3
Source File: ThreadLocalLeakPreventionListener.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
    try {
        String type = event.getType();
        if (Container.ADD_CHILD_EVENT.equals(type)) {
            processContainerAddChild(event.getContainer(),
                (Container) event.getData());
        } else if (Container.REMOVE_CHILD_EVENT.equals(type)) {
            processContainerRemoveChild(event.getContainer(),
                (Container) event.getData());
        }
    } catch (Exception e) {
        String msg =
            sm.getString(
                "threadLocalLeakPreventionListener.containerEvent.error",
                event);
        log.error(msg, e);
    }

}
 
Example #4
Source File: StandardEngine.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
    // Only useful for hosts
    if (disabled) return;
    if (Container.ADD_CHILD_EVENT.equals(event.getType())) {
        Context context = (Context) event.getData();
        if ("".equals(context.getPath())) {
            // Force re-calculation and disable listener since it won't
            // be re-used
            engine.defaultAccessLog.set(null);
            uninstall();
        }
    }
}
 
Example #5
Source File: ContainerBase.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Notify all container event listeners that a particular event has
 * occurred for this Container.  The default implementation performs
 * this notification synchronously using the calling thread.
 *
 * @param type Event type
 * @param data Event data
 */
@Override
public void fireContainerEvent(String type, Object data) {

    if (listeners.size() < 1)
        return;

    ContainerEvent event = new ContainerEvent(this, type, data);
    // Note for each uses an iterator internally so this is safe
    for (ContainerListener listener : listeners) {
        listener.containerEvent(event);
    }
}
 
Example #6
Source File: StandardEngine.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
    // Only useful for hosts
    if (disabled) return;
    if (Container.ADD_CHILD_EVENT.equals(event.getType())) {
        Context context = (Context) event.getData();
        if ("".equals(context.getPath())) {
            // Force re-calculation and disable listener since it won't
            // be re-used
            engine.defaultAccessLog.set(null);
            uninstall();
        }
    }
}
 
Example #7
Source File: ContainerBase.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Notify all container event listeners that a particular event has
 * occurred for this Container.  The default implementation performs
 * this notification synchronously using the calling thread.
 *
 * @param type Event type
 * @param data Event data
 */
@Override
public void fireContainerEvent(String type, Object data) {

    if (listeners.size() < 1)
        return;

    ContainerEvent event = new ContainerEvent(this, type, data);
    // Note for each uses an iterator internally so this is safe
    for (ContainerListener listener : listeners) {
        listener.containerEvent(event);
    }
}
 
Example #8
Source File: StandardEngine.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
    // Only useful for hosts
    if (disabled) return;
    if (Container.ADD_CHILD_EVENT.equals(event.getType())) {
        Context context = (Context) event.getData();
        if ("".equals(context.getPath())) {
            // Force re-calculation and disable listener since it won't
            // be re-used
            engine.defaultAccessLog.set(null);
            uninstall();
        }
    }
}
 
Example #9
Source File: TomEEContainerListener.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Override
public void containerEvent(final ContainerEvent event) {
    if ("beforeContextInitialized".equals(event.getType())) {
        CONTEXT.set((StandardContext) event.getContainer());
    } else if ("afterContextInitialized".equals(event.getType())) {
        CONTEXT.remove();
    }
}
 
Example #10
Source File: HeartbeatListener.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
}
 
Example #11
Source File: HeartbeatListener.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
}
 
Example #12
Source File: HeartbeatListener.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
public void containerEvent(ContainerEvent event) {
}
 
Example #13
Source File: NamingContextListener.java    From Tomcat8-Source-Read with MIT License 2 votes vote down vote up
/**
 * NO-OP.
 *
 * @param event ContainerEvent that has occurred
 *
 * @deprecated The {@link ContainerListener} interface and implementing
 *             methods will be removed from this class for Tomcat 10
 *             onwards.
 */
@Deprecated
@Override
public void containerEvent(ContainerEvent event) {
    // NO-OP
}