|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Process
edu.rice.cs.util.ProcessSequence
public class ProcessSequence
This class represents a sequence of processes. The inputs and outputs of the processes are not connected. One process wait until the preceding process has terminated. The class allows the entire sequence to be treated as if it were just one process. The constructor starts the first subprocess.
| Nested Class Summary | |
|---|---|
protected static class |
ProcessSequence.ProcessSequenceThreadGroup
Thread group for all threads that deal with this process sequence. |
| Field Summary | |
|---|---|
protected boolean |
_aborted
True if the execution was aborted. |
protected java.io.PipedInputStream |
_combinedErrorStream
The combined error stream of all processes. |
protected JoinInputStream |
_combinedInputJoinedWithDebugStream
The combined input stream of all the processes, plus a debug stream. |
protected java.io.PipedInputStream |
_combinedInputStream
The combined input stream of all processes. |
protected java.io.OutputStream |
_combinedOutputStream
The output stream of the currently executing process. |
protected java.io.PipedOutputStream |
_combinedStdErrStream
The stream into which all outputs to stderr are written. |
protected java.io.PipedOutputStream |
_combinedStdOutStream
The stream into which all outputs to stdout are written. |
protected ProcessCreator[] |
_creators
The process creators that create the processes in this process sequence. |
protected java.lang.Thread |
_deathThread
Thread that monitors the subprocesses and starts the next process when the previous one has terminated. |
protected java.io.PipedInputStream |
_debugInputStream
Debug input and output stream. |
protected java.io.PrintWriter |
_debugOutput
Debug output that gets joined with the streams from the processes. |
protected java.io.PipedOutputStream |
_debugOutputStream
|
protected int |
_index
Index of the currently running process. |
protected java.lang.Process[] |
_processes
The processes inside this process sequence. |
protected StreamRedirectThread |
_stdErrRedirector
The redirector thread that moves stderr output from one process to the input of the next process. |
protected StreamRedirectThread |
_stdOutRedirector
The redirector thread that moves stdout output from one process to the input of the next process. |
protected static java.lang.Process |
DUMMY_PROCESS
A process that does nothing. |
| Constructor Summary | |
|---|---|
ProcessSequence(ProcessCreator[] pcs)
Constructor for a process sequence consisting of the individual processes provided. |
|
| Method Summary | |
|---|---|
protected void |
connectProcess(java.lang.Process p)
Connect the streams of the specified process. |
void |
destroy()
Kills all subprocesses. |
int |
exitValue()
Returns the exit value for the subprocess. |
java.io.InputStream |
getErrorStream()
Gets the error stream of the process sequence, i.e. |
java.io.InputStream |
getInputStream()
Gets the input stream of the process sequence, i.e. |
java.io.OutputStream |
getOutputStream()
Gets the output stream of the process sequence, i.e. |
protected void |
stopAllRedirectors()
Set the stop flags for all redirector threads. |
int |
waitFor()
Causes the current thread to wait, if necessary, until the process sequence has terminated, i.e. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ProcessCreator[] _creators
protected java.lang.Process[] _processes
protected volatile int _index
protected volatile boolean _aborted
protected StreamRedirectThread _stdOutRedirector
protected StreamRedirectThread _stdErrRedirector
protected java.io.PipedInputStream _combinedInputStream
protected java.io.PipedOutputStream _combinedStdOutStream
protected JoinInputStream _combinedInputJoinedWithDebugStream
protected java.io.PrintWriter _debugOutput
protected java.io.PipedInputStream _debugInputStream
protected java.io.PipedOutputStream _debugOutputStream
protected java.io.PipedInputStream _combinedErrorStream
protected java.io.PipedOutputStream _combinedStdErrStream
protected volatile java.io.OutputStream _combinedOutputStream
protected java.lang.Thread _deathThread
protected static final java.lang.Process DUMMY_PROCESS
| Constructor Detail |
|---|
public ProcessSequence(ProcessCreator[] pcs)
pcs - array of ProcessCreators| Method Detail |
|---|
public java.io.OutputStream getOutputStream()
getOutputStream in class java.lang.Processpublic java.io.InputStream getErrorStream()
getErrorStream in class java.lang.Processpublic java.io.InputStream getInputStream()
getInputStream in class java.lang.Process
public int waitFor()
throws java.lang.InterruptedException
waitFor in class java.lang.Processjava.lang.InterruptedException - if the current thread is
interrupted by another thread
while it is waiting, then the wait is ended and an
InterruptedException is thrown.public int exitValue()
exitValue in class java.lang.ProcessProcess object. by convention, the value
0 indicates normal termination.
java.lang.IllegalThreadStateException - if the subprocess represented
by this Process object has not yet terminated.public void destroy()
ProcessChain object is forcibly terminated.
destroy in class java.lang.Processprotected void stopAllRedirectors()
protected void connectProcess(java.lang.Process p)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||