java.lang.Object
abbot.script.StepRunner
abbot.script.ForkedStepRunner
- All Implemented Interfaces:
- abbot.i18n.Resources, abbot.editor.i18n.Resources
- public class ForkedStepRunner
- extends StepRunner
A StepRunner that runs the step in a separate VM. Behavior should be
indistinguishable from the base StepRunner.
| Nested classes inherited from class abbot.editor.i18n.Resources |
abbot.editor.i18n.Resources.ResourceLoader |
| Fields inherited from class abbot.script.StepRunner |
|
| Methods inherited from class abbot.script.StepRunner |
addStepListener, clearErrors, fireStepEnd, fireStepError, fireStepEvent, fireStepFailure, fireStepProgress, fireStepStart, getError, getStopOnError, getStopOnFailure, launch, removeStepListener, run, setError, setStopOnError, setStopOnFailure, stop, stopped, terminate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LAUNCH_TIMEOUT
int LAUNCH_TIMEOUT
TERMINATE_TIMEOUT
int TERMINATE_TIMEOUT
serverSocket
private static java.net.ServerSocket serverSocket
process
private java.lang.Process process
connection
private java.net.Socket connection
ForkedStepRunner
public ForkedStepRunner()
fork
java.lang.Process fork(java.lang.String vmargs,
java.lang.String[] cmdArgs)
throws java.io.IOException
fork
java.lang.Process fork(java.lang.String vmargs)
throws java.net.UnknownHostException,
java.io.IOException
- Launch a new process, using this class as the main class.
runStep
public void runStep(Step step)
- Running the step in a separate VM should be indistinguishable from
running a regular script. When running as master, nothing actually
runs locally. We just fork a subprocess and run the script in that,
reporting back its progress as if it were running locally.
- Overrides:
runStep in class StepRunner
forkProcess
private java.lang.Process forkProcess(java.lang.String vmargs)
throws java.lang.Throwable
sendScript
private void sendScript(Script script)
throws java.io.IOException
trackScript
private void trackScript(Script script)
throws java.io.IOException
decodeStep
static Step decodeStep(Sequence root,
java.lang.String code)
encodeStep
static java.lang.String encodeStep(Sequence root,
Step step)
- Encode the given step into a set of indices.
receiveEvent
private StepEvent receiveEvent(Script script)
throws java.io.IOException
- Receive a serialized event on the connection and convert it back into
a real event, setting the given step's exception/error if necessary.
writeMessage
private static void writeMessage(java.net.Socket connection,
java.lang.String msg)
throws java.io.IOException
readMessage
private static java.lang.String readMessage(java.net.Socket connection)
throws java.io.IOException
main
public static void main(java.lang.String[] args)
- Provide means to control execution and feedback of a script in a
separate process.