use of org.apache.catalina.ContainerListener in project tomcat by apache.
the class ContainerMBean method findContainerListenerNames.
/**
* List the class name of each of the container listeners added to this
* container.
* @return the container listeners class names
* @throws MBeanException propagated from the managed resource access
*/
public String[] findContainerListenerNames() throws MBeanException {
Container container = doGetManagedResource();
List<String> result = new ArrayList<>();
ContainerListener[] listeners = container.findContainerListeners();
for (ContainerListener listener : listeners) {
result.add(listener.getClass().getName());
}
return result.toArray(new String[result.size()]);
}
use of org.apache.catalina.ContainerListener in project tomcat by apache.
the class StandardContext method createWrapper.
/**
* Factory method to create and return a new Wrapper instance, of
* the Java implementation class appropriate for this Context
* implementation. The constructor of the instantiated Wrapper
* will have been called, but no properties will have been set.
*/
@Override
public Wrapper createWrapper() {
Wrapper wrapper = null;
if (wrapperClass != null) {
try {
wrapper = (Wrapper) wrapperClass.newInstance();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error("createWrapper", t);
return (null);
}
} else {
wrapper = new StandardWrapper();
}
synchronized (wrapperLifecyclesLock) {
for (int i = 0; i < wrapperLifecycles.length; i++) {
try {
Class<?> clazz = Class.forName(wrapperLifecycles[i]);
LifecycleListener listener = (LifecycleListener) clazz.newInstance();
wrapper.addLifecycleListener(listener);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error("createWrapper", t);
return (null);
}
}
}
synchronized (wrapperListenersLock) {
for (int i = 0; i < wrapperListeners.length; i++) {
try {
Class<?> clazz = Class.forName(wrapperListeners[i]);
ContainerListener listener = (ContainerListener) clazz.newInstance();
wrapper.addContainerListener(listener);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log.error("createWrapper", t);
return (null);
}
}
}
return (wrapper);
}
Aggregations