Package org.apache.commons.launcher
Class ParentListener
java.lang.Object
java.lang.Thread
org.apache.commons.launcher.ParentListener
- All Implemented Interfaces:
Runnable
A class for detecting if the parent JVM that launched this process has
terminated.
- Author:
- Patrick Luby
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsConstructorDescriptionParentListener
(String path) Validates and caches a lock file created by the parent JVM. -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
Periodically check that the parent JVM has not terminated.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Constructor Details
-
ParentListener
Validates and caches a lock file created by the parent JVM.- Parameters:
path
- the lock file that the parent JVM has an open FileOutputStream- Throws:
IOException
- if the heartbeat cannot be converted into a valid File object
-
-
Method Details
-
run
public void run()Periodically check that the parent JVM has not terminated. On all platforms other than Windows, this method will check that System.in has not been closed. On Windows NT, 2000, and XP the lock file specified in theParentListener(String)
constructor is monitored as reading System.in will block the entire process on Windows machines that use some versions of Unix shells such as MKS, etc. No monitoring is done on Window 95, 98, and ME.
-