Package org.h2.test.utils
Class SelfDestructor
- java.lang.Object
-
- org.h2.test.utils.SelfDestructor
-
public class SelfDestructor extends java.lang.ObjectThis is a self-destructor class to kill a long running process automatically after a pre-defined time. The class reads the number of minutes from the system property 'h2.selfDestruct' and starts a countdown thread to kill the virtual machine if it still runs then.
-
-
Constructor Summary
Constructors Constructor Description SelfDestructor()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetPropertyString(int minutes)Get the string to be added when starting the Java process.static voidstartCountdown(int defaultMinutes)Start the countdown.
-
-
-
Method Detail
-
startCountdown
public static void startCountdown(int defaultMinutes)
Start the countdown. If the self-destruct system property is set, this value is used, otherwise the given default value is used.- Parameters:
defaultMinutes- the default number of minutes after which the current process is killed.
-
getPropertyString
public static java.lang.String getPropertyString(int minutes)
Get the string to be added when starting the Java process.- Parameters:
minutes- the countdown time in minutes- Returns:
- the setting
-
-