From dc41ee6c8f93eccfe8e8f24cfd0398e90ef1d197 Mon Sep 17 00:00:00 2001 From: "edburns%acm.org" Date: Fri, 12 Apr 2002 22:57:18 +0000 Subject: [PATCH] Added waitForDebugger. * Usage:

* Place a call to this method in the earliest possible entry point of * your servlet app. It will cause the app to enter into an infinite * loop, sleeping until the static var keepWaiting is set to false. The * idea is that you attach your debugger to the servlet, then, set a * breakpont in this method. When it is hit, you use the debugger to set * the keepWaiting class var to false. git-svn-id: svn://10.0.0.236/trunk@118883 18797224-902f-48f8-a5cc-f745e15eee43 --- .../util/classes/org/mozilla/util/Debug.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/mozilla/java/util/classes/org/mozilla/util/Debug.java b/mozilla/java/util/classes/org/mozilla/util/Debug.java index c40e51ba991..b7e54c93a2a 100644 --- a/mozilla/java/util/classes/org/mozilla/util/Debug.java +++ b/mozilla/java/util/classes/org/mozilla/util/Debug.java @@ -56,7 +56,7 @@ import java.util.Date; * *

* @author Keith Bernstein - * @version $Id: Debug.java,v 1.2 1999-11-06 02:25:55 dmose%mozilla.org Exp $ */ + * @version $Id: Debug.java,v 1.3 2002-04-12 22:57:18 edburns%acm.org Exp $ */ public class Debug extends Object { static public final String HELP_FILTER_STRING = "HELP"; @@ -77,6 +77,10 @@ public class Debug extends Object { static long startTime = 0L; static long lapTime = 0L; + public static boolean keepWaiting = true; + + + static { /** This code adds to the filters Vector from the * System.Properties variable named by PROPERTY_NAME @@ -97,6 +101,32 @@ public class Debug extends Object { } } +/** + +* Usage:

+ +* Place a call to this method in the earliest possible entry point of +* your servlet app. It will cause the app to enter into an infinite +* loop, sleeping until the static var keepWaiting is set to false. The +* idea is that you attach your debugger to the servlet, then, set a +* breakpont in this method. When it is hit, you use the debugger to set +* the keepWaiting class var to false. + +*/ + +public static void waitForDebugger() { + while (keepWaiting) { + try { + Thread.sleep(5000); + } + catch (InterruptedException e) { + System.out.println("DebugUtil.waitForDebugger(): Exception: " + + e.getMessage()); + } + } +} + + /** * Sets a debug filter, for future consumption by this class, as well as other * utility classes, like Log, etc.