InstanceSupportpublic final class InstanceSupport extends Object Support class to assist in firing InstanceEvent notifications to
registered InstanceListeners. |
Fields Summary |
---|
private org.apache.catalina.InstanceListener[] | listenersThe set of registered InstanceListeners for event notifications. | private org.apache.catalina.Wrapper | wrapperThe source component for instance events that we will fire. |
Constructors Summary |
---|
public InstanceSupport(org.apache.catalina.Wrapper wrapper)Construct a new InstanceSupport object associated with the specified
Instance component.
super();
this.wrapper = wrapper;
|
Methods Summary |
---|
public void | addInstanceListener(org.apache.catalina.InstanceListener listener)Add a lifecycle event listener to this component.
synchronized (listeners) {
InstanceListener results[] =
new InstanceListener[listeners.length + 1];
for (int i = 0; i < listeners.length; i++)
results[i] = listeners[i];
results[listeners.length] = listener;
listeners = results;
}
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, servlet, type,
request, response);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Servlet servlet, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.Throwable exception)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, servlet, type,
request, response, exception);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Filter filter)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, filter, type);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Filter filter, java.lang.Throwable exception)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, filter, type,
exception);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Filter filter, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, filter, type,
request, response);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Filter filter, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, java.lang.Throwable exception)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, filter, type,
request, response, exception);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Servlet servlet)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, servlet, type);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public void | fireInstanceEvent(java.lang.String type, javax.servlet.Servlet servlet, java.lang.Throwable exception)Notify all lifecycle event listeners that a particular event has
occurred for this Container. The default implementation performs
this notification synchronously using the calling thread.
if (listeners.length == 0)
return;
InstanceEvent event = new InstanceEvent(wrapper, servlet, type,
exception);
InstanceListener interested[] = listeners;
for (int i = 0; i < interested.length; i++)
interested[i].instanceEvent(event);
| public org.apache.catalina.Wrapper | getWrapper()Return the Wrapper with which we are associated.
// ------------------------------------------------------------- Properties
return (this.wrapper);
| public void | removeInstanceListener(org.apache.catalina.InstanceListener listener)Remove a lifecycle event listener from this component.
synchronized (listeners) {
int n = -1;
for (int i = 0; i < listeners.length; i++) {
if (listeners[i] == listener) {
n = i;
break;
}
}
if (n < 0)
return;
InstanceListener results[] =
new InstanceListener[listeners.length - 1];
int j = 0;
for (int i = 0; i < listeners.length; i++) {
if (i != n)
results[j++] = listeners[i];
}
listeners = results;
}
|
|