Apache CXF API

org.apache.cxf.common.commands
Class ForkedCommand

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.cxf.common.commands.ForkedCommand
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
ResultBufferedCommand

public class ForkedCommand
extends Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int DEFAULT_TIMEOUT
           
static String EXE_SUFFIX
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ForkedCommand()
           
ForkedCommand(String[] args)
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Thread
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, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXE_SUFFIX

public static final String EXE_SUFFIX

DEFAULT_TIMEOUT

public static final int DEFAULT_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

ForkedCommand

public ForkedCommand()

ForkedCommand

public ForkedCommand(String[] args)
Method Detail

setArgs

protected void setArgs(String[] args)

setEnvironment

public void setEnvironment(String[] env)

toString

public String toString()
Overrides:
toString in class Thread

joinErrOut

public void joinErrOut(boolean flag)
Determines if the threads collecting the forked process' stdout/stderr should be joined.

Parameters:
flag - boolean indicating if threads should be joined

execute

public int execute()

execute

public int execute(int timeout)
Executes the process. If the process has not completed after the specified amount of seconds, it is killed.

Parameters:
timeout - the timeout in seconds
Throws:
ForkedCommandException - if process execution fails for some reason or if the timeout has expired and the process was killed

run

public void run()
Implements the run method for the thread on which the process is executed.

Specified by:
run in interface Runnable
Overrides:
run in class Thread

setOutputStream

public void setOutputStream(PrintStream os)

setErrorStream

public void setErrorStream(PrintStream es)

Apache CXF API

Apache CXF