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 String
private static final String
private static final String
private Process
Process object of the JVM.private boolean
If set to TRUE, output and error streams are redirected to the main JVM output streamprivate Class
<?> Start class of the JVM.private boolean
If set to TRUE, main JVM will wait for this JVM to stop before exiting.private String
Xms parameter.private String
Xmx parameter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String
boolean
Class
<?> boolean
getXms()
getXmx()
void
run()
void
setEnvironment
(Map<String, String> environment) void
setRedirectStreams
(boolean redirectStreams) void
setStartClass
(Class<?> startClass) void
setWaitBeforeExiting
(boolean waitBeforeExiting) void
void
void
start()
void
void
stop()
-
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
-