com.googlepages.dronten.jripper.util
Class ProcessRunner

java.lang.Object
  extended by java.lang.Thread
      extended by com.googlepages.dronten.jripper.util.BaseThread
          extended by com.googlepages.dronten.jripper.util.ProcessRunner
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ProcessRunnerReadFileWriteFile, ProcessRunnerReadFileWriteProc, ProcessRunnerReadProc, ProcessRunnerReadProcWriteFile, ProcessRunnerReadProcWriteProc, ProcessRunnerReadStdoutAndStderrProc

public class ProcessRunner
extends BaseThread

Process thread that uses other threads for reading from child thread outputs. One of the reader can also write to another child process.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  int aExitReadCode
           
protected  int aExitWriteCode
           
protected  java.lang.String aReadFileName
           
protected  ProcessParam aReadParam
           
protected  java.lang.Process aReadProcess
           
protected  StreamThread aThread1
           
protected  StreamThread aThread2
           
protected  java.lang.String aWriteFileName
           
protected  ProcessParam aWriteParam
           
protected  java.lang.Process aWriteProcess
           
 
Fields inherited from class com.googlepages.dronten.jripper.util.BaseThread
aProgress, aRunning
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProcessRunner(Log log, Progress progress)
           
 
Method Summary
 void close()
          Close reader threads and wait for processes to end.
 int getExitReadCode()
          Return exit code of the reading process.
 int getExitWriteCode()
          Get the exit code of the writing process.
 StreamThread getThread1()
           
 boolean hasFailed()
          Return status of exit codes.
 void run()
          Run all processes until they are done.
 void stopLogging()
          Tell this thread and all child threads to stop logging.
 
Methods inherited from class com.googlepages.dronten.jripper.util.BaseThread
addLog, getLog, getTrackNum, setFailed, setLog, setTrackNum, stopRunning
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

aExitReadCode

protected int aExitReadCode

aExitWriteCode

protected int aExitWriteCode

aThread1

protected StreamThread aThread1

aThread2

protected StreamThread aThread2

aReadProcess

protected java.lang.Process aReadProcess

aWriteProcess

protected java.lang.Process aWriteProcess

aReadParam

protected ProcessParam aReadParam

aReadFileName

protected java.lang.String aReadFileName

aWriteParam

protected ProcessParam aWriteParam

aWriteFileName

protected java.lang.String aWriteFileName
Constructor Detail

ProcessRunner

public ProcessRunner(Log log,
                     Progress progress)
Parameters:
log -
progress -
Method Detail

close

public void close()
Close reader threads and wait for processes to end.

Overrides:
close in class BaseThread

getExitReadCode

public int getExitReadCode()
Return exit code of the reading process.

Returns:
Exit code from read process

getExitWriteCode

public int getExitWriteCode()
Get the exit code of the writing process.

Returns:
Exit code from write process

getThread1

public StreamThread getThread1()
Returns:
Thread 1

hasFailed

public boolean hasFailed()
Return status of exit codes.

Overrides:
hasFailed in class BaseThread
Returns:
true if it has failed

run

public void run()
Run all processes until they are done.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

stopLogging

public void stopLogging()
Tell this thread and all child threads to stop logging.

Overrides:
stopLogging in class BaseThread