public class JavaProcessManager
extends java.lang.Object
| Constructor and Description |
|---|
JavaProcessManager(java.lang.Class<?> classWithMainMethod,
java.util.Properties systemProperties,
java.lang.String[] programArgs)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getExitValue()
Returns the exit value of the process associated with this manager.
|
boolean |
isAlive()
Returns true when the process associated with this manager instance is still
alive.
|
boolean |
shutdown()
Attempts to send an OS signal to kill the process associated with this
class instance; WAITS for up to one second for the process to terminate;
returns success indicator.
|
boolean |
start(boolean outputCaptureEnable)
Attempts to start a new JVM process based on the information supplied in
the class constructor; returns success indicator.
|
boolean |
waitFor(long timeout,
java.util.concurrent.TimeUnit timeUnit)
Waits for the process associated with this manager to terminate or for a
timeout to occur, whichever comes soonest.
|
public JavaProcessManager(java.lang.Class<?> classWithMainMethod,
java.util.Properties systemProperties,
java.lang.String[] programArgs)
classWithMainMethod - the Java class which contains the main method
to be executed.systemProperties - the system properties to be added to the spawned
process over and above what is already provided by the platform.programArgs - the program arguments.java.lang.NullPointerException - if any of the supplied arguments were null.public boolean start(boolean outputCaptureEnable)
outputCaptureEnable - whether the output from the spawned process
should be logged.public boolean shutdown()
public boolean isAlive()
public boolean waitFor(long timeout,
java.util.concurrent.TimeUnit timeUnit)
throws java.lang.InterruptedException
timeout - the maximum time to wait.timeUnit - the time units.java.lang.InterruptedException - if the current thread was interrupted while waiting.public int getExitValue()
java.lang.IllegalThreadStateException - - if the process has not yet
terminated.