Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java2
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java1
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerCollection.java13
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerWrapper.java16
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/handler/HotSwapHandler.java16
5 files changed, 42 insertions, 6 deletions
diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java
index 969a601546..3b093440e8 100644
--- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java
+++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/bindings/StandardUndeployer.java
@@ -53,7 +53,7 @@ public class StandardUndeployer implements AppLifeCycle.Binding
{
Log.debug("Removing handler: " + child);
coll.removeHandler(child);
- ((ContextHandler)child).destroy();
+ child.destroy();
Log.debug(String.format("After removal: %d (originally %d)",coll.getHandlers().length,originalCount));
}
else if (child instanceof HandlerCollection)
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
index 685b1878cd..c238d8bc87 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java
@@ -21,7 +21,6 @@ import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.EventListener;
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerCollection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerCollection.java
index 26c7ff509c..46a2e21b08 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerCollection.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerCollection.java
@@ -298,5 +298,16 @@ public class HandlerCollection extends AbstractHandlerContainer
return list;
}
-
+ /* ------------------------------------------------------------ */
+ @Override
+ public void destroy()
+ {
+ if (!isStopped())
+ throw new IllegalStateException("!STOPPED");
+ Handler[] children=getChildHandlers();
+ setHandlers(null);
+ for (Handler child: children)
+ child.destroy();
+ super.destroy();
+ }
}
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerWrapper.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerWrapper.java
index 1d0feacac2..7b3f631b45 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerWrapper.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HandlerWrapper.java
@@ -163,6 +163,20 @@ public class HandlerWrapper extends AbstractHandlerContainer
return null;
}
-
+
+ /* ------------------------------------------------------------ */
+ @Override
+ public void destroy()
+ {
+ if (!isStopped())
+ throw new IllegalStateException("!STOPPED");
+ Handler child=getHandler();
+ if (child!=null)
+ {
+ setHandler(null);
+ child.destroy();
+ }
+ super.destroy();
+ }
}
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HotSwapHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HotSwapHandler.java
index 0b02b237f0..106519015c 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HotSwapHandler.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/HotSwapHandler.java
@@ -155,7 +155,6 @@ public class HotSwapHandler extends AbstractHandlerContainer
server.getContainer().update(this, null,_handler, "handler");
}
-
/* ------------------------------------------------------------ */
@Override
protected Object expandChildren(Object list, Class byClass)
@@ -163,5 +162,18 @@ public class HotSwapHandler extends AbstractHandlerContainer
return expandHandler(_handler,list,byClass);
}
-
+ /* ------------------------------------------------------------ */
+ @Override
+ public void destroy()
+ {
+ if (!isStopped())
+ throw new IllegalStateException("!STOPPED");
+ Handler child=getHandler();
+ if (child!=null)
+ {
+ setHandler(null);
+ child.destroy();
+ }
+ super.destroy();
+ }
}

Back to the top