Package org.jppf.node.provisioning
Class SlaveNodeLauncher
java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.process.AbstractProcessLauncher
org.jppf.node.provisioning.SlaveNodeLauncher
- All Implemented Interfaces:
Runnable
public class SlaveNodeLauncher
extends org.jppf.process.AbstractProcessLauncher
This class wraps a single slave node process and provides an API to start, stop and monitor it.
- Since:
- 4.1
- Author:
- Laurent Cohen
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jppf.process.AbstractProcessLauncher
org.jppf.process.AbstractProcessLauncher.SlaveSocketWrapper -
Field Summary
Fields inherited from class org.jppf.process.AbstractProcessLauncher
end, listeners, name, process, processPort, processServer, slaveSocketWrapperFields inherited from class org.jppf.utils.concurrent.ThreadSynchronization
stopped -
Constructor Summary
ConstructorsConstructorDescriptionSlaveNodeLauncher(int id, String name, List<String> classpath) Initialize this process launcher.SlaveNodeLauncher(int id, String name, List<String> classpath, long startDelay) Initialize this process launcher. -
Method Summary
Modifier and TypeMethodDescriptionintgetId()Get the id given to this process.booleanDetermine whether the slave node is started.booleanDetermine whether the slave node is stopped.protected booleanonProcessExit(int n) Called when the subprocess has exited with exit value n.voidrun()Start the subprocess.voidsetStarted(boolean started) Specify whether the slave node is started.voidsetStopped(boolean stopped) Specify whether the slave node is stopped.Methods inherited from class org.jppf.process.AbstractProcessLauncher
addProcessLauncherListener, buildClasspath, computeJavaExecPath, createShutdownHook, fireProcessStarted, fireProcessStopped, getName, getProcess, parseJvmOptions, removeProcessLauncherListener, sendActionCommand, startSocketListener, tearDownMethods inherited from class org.jppf.utils.concurrent.ThreadSynchronization
goToSleep, goToSleep, goToSleep, wakeUp
-
Constructor Details
-
SlaveNodeLauncher
Initialize this process launcher.- Parameters:
id- the id as an int.name- internal name given tot he process.classpath- the slave node's classpath.
-
SlaveNodeLauncher
Initialize this process launcher.- Parameters:
id- the id as an int.name- internal name given tot he process.classpath- the slave node's classpath.startDelay- how log to wait before actually starting the slave process.
-
-
Method Details
-
run
public void run()Start the subprocess. If exit code is 2, then the subprocess is restarted. -
onProcessExit
protected boolean onProcessExit(int n) Called when the subprocess has exited with exit value n. This allows for printing the residual output (both standard and error) to this pJVM's console and log file, in order to get additional information if a problem occurred.- Specified by:
onProcessExitin classorg.jppf.process.AbstractProcessLauncher- Parameters:
n- the exit value of the subprocess.- Returns:
- true if this launcher is to be terminated, false if it should re-launch the subprocess.
-
getId
public int getId()Get the id given to this process.- Returns:
- the id as an int.
-
isStarted
public boolean isStarted()Determine whether the slave node is started.- Returns:
trueif the slave is started,falseotherwise.
-
setStarted
public void setStarted(boolean started) Specify whether the slave node is started.- Parameters:
started-trueif the slave is started,falseotherwise.
-
isStopped
public boolean isStopped()Determine whether the slave node is stopped.- Overrides:
isStoppedin classorg.jppf.utils.concurrent.ThreadSynchronization- Returns:
trueif the slave is stopped,falseotherwise.
-
setStopped
public void setStopped(boolean stopped) Specify whether the slave node is stopped.- Overrides:
setStoppedin classorg.jppf.utils.concurrent.ThreadSynchronization- Parameters:
stopped-trueif the slave is stopped,falseotherwise.
-
getLaunchCommand
- Returns:
- the command line used to start the slave node process.
-