Author: remy.maucherat(a)jboss.com
Date: 2014-12-05 05:06:08 -0500 (Fri, 05 Dec 2014)
New Revision: 2568
Modified:
branches/7.5.x/src/main/java/org/apache/catalina/Lifecycle.java
branches/7.5.x/src/main/java/org/apache/catalina/core/StandardContext.java
Log:
JBWEB-308: Add extra hooks.
Modified: branches/7.5.x/src/main/java/org/apache/catalina/Lifecycle.java
===================================================================
--- branches/7.5.x/src/main/java/org/apache/catalina/Lifecycle.java 2014-12-04 15:06:08
UTC (rev 2567)
+++ branches/7.5.x/src/main/java/org/apache/catalina/Lifecycle.java 2014-12-05 10:06:08
UTC (rev 2568)
@@ -107,6 +107,18 @@
public static final String LOAD_ON_STARTUP_EVENT = "load_on_startup";
+ /**
+ * The LifecycleEvent type for the "component before unload" event.
+ */
+ public static final String BEFORE_UNLOAD_EVENT = "before_unload";
+
+
+ /**
+ * The LifecycleEvent type for the "component after unload" event.
+ */
+ public static final String AFTER_UNLOAD_EVENT = "after_unload";
+
+
// --------------------------------------------------------- Public Methods
Modified: branches/7.5.x/src/main/java/org/apache/catalina/core/StandardContext.java
===================================================================
--- branches/7.5.x/src/main/java/org/apache/catalina/core/StandardContext.java 2014-12-04
15:06:08 UTC (rev 2567)
+++ branches/7.5.x/src/main/java/org/apache/catalina/core/StandardContext.java 2014-12-05
10:06:08 UTC (rev 2568)
@@ -3906,8 +3906,23 @@
// Stop our child containers, if any
Container[] children = findChildren();
for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof Lifecycle)
+ if (children[i] instanceof Lifecycle){
+ StandardWrapper standardWrapper = null;
+ if(children[i] instanceof StandardWrapper){
+ standardWrapper = (StandardWrapper) children[i];
+ }
+
+ // it might be better to use InstanceEvent, but JBossContextConfig
implements LifecycleListener
+ if(standardWrapper != null){
+ lifecycle.fireLifecycleEvent(Lifecycle.BEFORE_UNLOAD_EVENT,
standardWrapper.getServletClass());
+ }
+
((Lifecycle) children[i]).stop();
+
+ if(standardWrapper != null){
+ lifecycle.fireLifecycleEvent(Lifecycle.AFTER_UNLOAD_EVENT,
standardWrapper.getServletClass());
+ }
+ }
}
// Stop our filters
Show replies by date