diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java index f6f3f1c526b..9e418932111 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ShutdownMonitor.java @@ -64,6 +64,11 @@ public class ShutdownMonitor return Holder.instance; } + protected static void reset() + { + Holder.instance = new ShutdownMonitor(); + } + public static void register(LifeCycle... lifeCycles) { getInstance().addLifeCycles(lifeCycles); diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ShutdownMonitorTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ShutdownMonitorTest.java index a56639929e8..f0e4e7f1f67 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ShutdownMonitorTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ShutdownMonitorTest.java @@ -26,6 +26,7 @@ import java.net.InetAddress; import java.net.Socket; import org.eclipse.jetty.util.thread.ShutdownThread; +import org.junit.AfterClass; import org.junit.Test; import static org.junit.Assert.assertEquals; @@ -33,6 +34,12 @@ import static org.junit.Assert.assertTrue; public class ShutdownMonitorTest { + @AfterClass + public static void afterClass() + { + ShutdownMonitor.reset(); + } + @Test public void testShutdownMonitor() throws Exception {