java.io.SerializableCollectingProcessOutput, ConsoleOutputProcessOutput, StreamingProcessOutputpublic abstract class AbstractProcessOutput
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field | Description |
|---|---|---|
protected java.lang.String[] |
m_Command |
the command.
|
protected java.lang.String[] |
m_Environment |
the environment variables.
|
protected int |
m_ExitCode |
the exit code.
|
protected java.lang.Process |
m_Process |
the process.
|
protected AbstractProcessReader |
m_ReaderStdErr |
for monitoring stderr.
|
protected AbstractProcessReader |
m_ReaderStdOut |
for monitoring stdout.
|
protected AbstractProcessRunnable |
m_RunnableTimeout |
for monitoring timeouts.
|
protected boolean |
m_TimedOut |
whether the process has timed out.
|
protected int |
m_TimeOut |
the timeout for the process in seconds (ignored if < 1).
|
| Constructor | Description |
|---|---|
AbstractProcessOutput() |
Starts the monitoring process.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract AbstractProcessReader |
configureStdErr() |
Configures the reader for stderr.
|
protected abstract AbstractProcessReader |
configureStdOut() |
Configures the reader for stdout.
|
protected AbstractProcessRunnable |
configureTimeOutMonitor() |
Configures the runnable for watching for time outs.
|
void |
destroy() |
Destroys the process if possible.
|
java.lang.String[] |
getCommand() |
Returns the command that was used for the process.
|
java.lang.String[] |
getEnvironment() |
Returns the environment.
|
int |
getExitCode() |
Returns the exit code.
|
java.lang.Process |
getProcess() |
Returns the process.
|
int |
getTimeOut() |
Returns the timeout for the process in seconds.
|
boolean |
hasSucceeded() |
Returns whether the process has succeeded.
|
boolean |
hasTimedOut() |
Returns whether the process timed out and got terminated.
|
protected void |
initialize() |
For initializing the members.
|
void |
monitor(java.lang.ProcessBuilder builder) |
Performs the actual process monitoring.
|
void |
monitor(java.lang.String[] cmd,
java.lang.String[] env,
java.lang.String input,
java.lang.Process process) |
Performs the actual process monitoring.
|
void |
monitor(java.lang.String input,
java.lang.ProcessBuilder builder) |
Performs the actual process monitoring.
|
void |
monitor(java.lang.String cmd,
java.lang.String[] env,
java.lang.Process process) |
Performs the actual process monitoring.
|
void |
monitor(java.lang.String cmd,
java.lang.String[] env,
java.lang.String input,
java.lang.Process process) |
Performs the actual process monitoring.
|
void |
setTimeOut(int value) |
Sets the timeout for the process in seconds.
|
java.lang.String |
toString() |
Returns a short description string.
|
protected java.lang.String[] m_Command
protected java.lang.String[] m_Environment
protected int m_ExitCode
protected transient java.lang.Process m_Process
protected int m_TimeOut
protected boolean m_TimedOut
protected transient AbstractProcessReader m_ReaderStdErr
protected transient AbstractProcessReader m_ReaderStdOut
protected transient AbstractProcessRunnable m_RunnableTimeout
public AbstractProcessOutput()
protected void initialize()
public void setTimeOut(int value)
value - the timeout (less than 1 for no timeout)public int getTimeOut()
public void monitor(java.lang.ProcessBuilder builder)
throws java.lang.Exception
builder - the process builder to monitorjava.lang.Exception - if writing to stdin failspublic void monitor(java.lang.String input,
java.lang.ProcessBuilder builder)
throws java.lang.Exception
builder - the process builder to monitorjava.lang.Exception - if writing to stdin failspublic void monitor(java.lang.String cmd,
java.lang.String[] env,
java.lang.Process process)
throws java.lang.Exception
cmd - the command that was usedenv - the environmentprocess - the process to monitorjava.lang.Exception - if writing to stdin failspublic void monitor(java.lang.String cmd,
java.lang.String[] env,
java.lang.String input,
java.lang.Process process)
throws java.lang.Exception
cmd - the command that was usedenv - the environmentinput - the input to be written to the process via stdin, ignored if nullprocess - the process to monitorjava.lang.Exception - if writing to stdin failspublic void monitor(java.lang.String[] cmd,
java.lang.String[] env,
java.lang.String input,
java.lang.Process process)
throws java.lang.Exception
cmd - the command that was usedenv - the environmentinput - the input to be written to the process via stdin, ignored if nullprocess - the process to monitorjava.lang.Exception - if writing to stdin failsprotected abstract AbstractProcessReader configureStdErr()
protected abstract AbstractProcessReader configureStdOut()
protected AbstractProcessRunnable configureTimeOutMonitor()
public java.lang.String[] getCommand()
public java.lang.String[] getEnvironment()
public boolean hasSucceeded()
hasTimedOut()public int getExitCode()
public boolean hasTimedOut()
getTimeOut(),
setTimeOut(int)public java.lang.Process getProcess()
public void destroy()
public java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2019 University of Waikato, Hamilton, NZ. All Rights Reserved.