Package info.freelibrary.util
Class ProcessWatcher
- java.lang.Object
-
- java.lang.Thread
-
- info.freelibrary.util.ProcessWatcher
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description ProcessWatcher(ProcessBuilder aProcessBuilder)
Creates a watcher for aProcess
started by the suppliedProcessBuilder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessWatcher
addListener(ProcessListener aListener)
Add aProcessListener
to this watcher.ProcessWatcher
removeListener(ProcessListener aListener)
Remove aProcessListener
to this watcher.void
run()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield
-
-
-
-
Constructor Detail
-
ProcessWatcher
public ProcessWatcher(ProcessBuilder aProcessBuilder) throws IOException
Creates a watcher for aProcess
started by the suppliedProcessBuilder
.- Parameters:
aProcessBuilder
- A builder that will spawn the process to watch- Throws:
IOException
- If there is trouble starting the process
-
-
Method Detail
-
addListener
public ProcessWatcher addListener(ProcessListener aListener)
Add aProcessListener
to this watcher.- Parameters:
aListener
- A process listener to add to this watcher- Returns:
- The process watcher to which the listener has been attached
-
removeListener
public ProcessWatcher removeListener(ProcessListener aListener)
Remove aProcessListener
to this watcher.- Parameters:
aListener
- A process listener to remove from this watcher- Returns:
- The process watcher to which the listener has been attached
-
-