qat.plugins.chorus
Class ExecProcess

java.lang.Object
  extended byjava.lang.Thread
      extended byqat.plugins.chorus.ExecProcess
All Implemented Interfaces:
java.lang.Runnable

public class ExecProcess
extends java.lang.Thread

This class is responsible for executing a single TestObject, and starting new threads to read it's standard output and error output streams. It allows for killing of the started TestObject at anytime by calling the cancel() method.


Field Summary
static int TIMEDOUT_STATE
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ExecProcess(java.lang.String command, Console console)
           
 
Method Summary
 int checkExitValue()
          This function returns the exit value of the running process if it has finished else it returns a negative value.
 java.lang.String getProcessOutput()
          This method will execute the process, and return once it is finished.
 void interrupt()
          This will kill the TestObject execution and free all the resource associated with this TestObject execution.
 void run()
          This form will read the output of an executed process as a thread, and execution returns immediately.
 void setCommand(java.lang.String c)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TIMEDOUT_STATE

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

ExecProcess

public ExecProcess(java.lang.String command,
                   Console console)
Method Detail

run

public void run()
This form will read the output of an executed process as a thread, and execution returns immediately.


setCommand

public void setCommand(java.lang.String c)

getProcessOutput

public java.lang.String getProcessOutput()
                                  throws java.lang.Exception
This method will execute the process, and return once it is finished. It waits for all the output to be completed before returning.

Throws:
java.lang.Exception

checkExitValue

public int checkExitValue()
This function returns the exit value of the running process if it has finished else it returns a negative value. This method will not block if the process is still running.

Returns:
the absolute value of the exit value of the process, or a negative int to indicate other thread states (ILLEGAL_THREAD_STATE, NULL_POINTER, OTHER_EXCEPTION)

interrupt

public void interrupt()
This will kill the TestObject execution and free all the resource associated with this TestObject execution.



See QAT project for licensing details