From 57849a905f4e35e1620a250e42b2af03336717ca Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 3 Dec 2012 13:04:03 -0700 Subject: [PATCH] Adding -Dtest.slow.destroy support to CookieDump to aid in testing of start.jar -DSTOP.WAIT=360 --stop --- .../src/main/java/com/acme/CookieDump.java | 18 ++++++++++++++++++ .../src/main/java/com/acme/HelloWorld.java | 4 ---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test-jetty-webapp/src/main/java/com/acme/CookieDump.java b/test-jetty-webapp/src/main/java/com/acme/CookieDump.java index 5e045227d77..46145898ecc 100644 --- a/test-jetty-webapp/src/main/java/com/acme/CookieDump.java +++ b/test-jetty-webapp/src/main/java/com/acme/CookieDump.java @@ -19,6 +19,7 @@ package com.acme; import java.io.IOException; import java.io.PrintWriter; +import java.util.concurrent.TimeUnit; import javax.servlet.ServletException; import javax.servlet.http.Cookie; @@ -121,4 +122,21 @@ public class CookieDump extends HttpServlet return string; } + @Override + public void destroy() + { + // For testing --stop with STOP.WAIT handling of the jetty-start behavior. + if (Boolean.getBoolean("test.slow.destroy")) + { + try + { + TimeUnit.SECONDS.sleep(10); + } + catch (InterruptedException e) + { + // ignore + } + } + super.destroy(); + } } diff --git a/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java b/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java index abacf87805c..67caa063480 100644 --- a/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java +++ b/test-jetty-webapp/src/main/java/com/acme/HelloWorld.java @@ -67,8 +67,4 @@ public class HelloWorld extends HttpServlet getServletContext().log("exception",e); } } - - - - }