public class ForkedCommand extends Thread
Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_TIMEOUT |
static String |
EXE_SUFFIX |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
ForkedCommand() |
ForkedCommand(String[] args) |
| Modifier and Type | Method and Description |
|---|---|
int |
execute() |
int |
execute(int timeout)
Executes the process.
|
void |
joinErrOut(boolean flag)
Determines if the threads collecting the forked process' stdout/stderr
should be joined.
|
void |
run()
Implements the run method for the thread on which the process is
executed.
|
protected void |
setArgs(String[] args) |
void |
setEnvironment(String[] env) |
void |
setErrorStream(PrintStream es) |
void |
setOutputStream(PrintStream os) |
String |
toString() |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yieldpublic static final String EXE_SUFFIX
public static final int DEFAULT_TIMEOUT
public ForkedCommand()
public ForkedCommand(String[] args)
protected void setArgs(String[] args)
public void setEnvironment(String[] env)
public void joinErrOut(boolean flag)
flag - boolean indicating if threads should be joinedpublic int execute()
public int execute(int timeout)
timeout - the timeout in secondsForkedCommandException - if process execution fails for some reason
or if the timeout has expired and the process was killedpublic void run()
public void setOutputStream(PrintStream os)
public void setErrorStream(PrintStream es)
Apache CXF