Package org.ghost4j.util
Class JavaFork
java.lang.Object
org.ghost4j.util.JavaFork
- All Implemented Interfaces:
Runnable
This class allows launching another JVM from the current JVM. It takes the
same classpath as the parent JVM.
-
Field Summary
FieldsModifier and TypeFieldDescriptionAdditional environment variables.private static final Stringprivate static final Stringprivate static final Stringprivate ProcessProcess object of the JVM.private booleanIf set to TRUE, output and error streams are redirected to the main JVM output streamprivate Class<?> Start class of the JVM.private booleanIf set to TRUE, main JVM will wait for this JVM to stop before exiting.private StringXms parameter.private StringXmx parameter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate StringbooleanClass<?> booleangetXms()getXmx()voidrun()voidsetEnvironment(Map<String, String> environment) voidsetRedirectStreams(boolean redirectStreams) voidsetStartClass(Class<?> startClass) voidsetWaitBeforeExiting(boolean waitBeforeExiting) voidvoidvoidstart()voidvoidstop()
-
Field Details
-
JAVA_COMMAND
-
PATH_SEPARATOR
-
FILE_SEPARATOR
-
startClass
Start class of the JVM. -
process
Process object of the JVM. Is null if the JVM is not running. -
redirectStreams
private boolean redirectStreamsIf set to TRUE, output and error streams are redirected to the main JVM output stream -
waitBeforeExiting
private boolean waitBeforeExitingIf set to TRUE, main JVM will wait for this JVM to stop before exiting. -
environment
Additional environment variables. -
xmx
Xmx parameter. Default value is set to 128M. -
xms
Xms parameter. Default value is set to 64M.
-
-
Constructor Details
-
JavaFork
public JavaFork()
-
-
Method Details
-
start
-
start
public void start() -
stop
public void stop() -
run
public void run() -
getCurrentClasspath
-
getStartClass
-
setStartClass
-
getRedirectStreams
public boolean getRedirectStreams() -
setRedirectStreams
public void setRedirectStreams(boolean redirectStreams) -
getWaitBeforeExiting
public boolean getWaitBeforeExiting() -
setWaitBeforeExiting
public void setWaitBeforeExiting(boolean waitBeforeExiting) -
getEnvironment
-
setEnvironment
-
getXmx
-
setXmx
-
getXms
-
setXms
-