Class AbstractProcessRunnable
- java.lang.Object
-
- com.github.fracpete.processoutput4j.core.AbstractProcessRunnable
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
AbstractProcessReader
public abstract class AbstractProcessRunnable extends java.lang.Object implements java.lang.RunnableAncestor for runnables that use aProcessobject.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description AbstractProcessRunnable()Initializes the reader.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoRun()The actual processing loop.java.lang.ProcessgetProcess()Returns the underlyingProcessobject.booleanisStopped()Returns whether execution got stopped.protected voidlogError(java.lang.String msg)Just outputs the message on stderr.protected voidlogError(java.lang.String msg, java.lang.Throwable t)Just outputs message and throwable on stderr.voidrun()Reads the data from the process.voidsetProcess(java.lang.Process value)Sets the process to monitor.voidstopExecution()Stops the execution.
-
-
-
Method Detail
-
stopExecution
public void stopExecution()
Stops the execution.
-
isStopped
public boolean isStopped()
Returns whether execution got stopped.- Returns:
- true if stopped
-
setProcess
public void setProcess(java.lang.Process value)
Sets the process to monitor.- Parameters:
value- the process object
-
getProcess
public java.lang.Process getProcess()
Returns the underlyingProcessobject.- Returns:
- the process object, null if none set
-
logError
protected void logError(java.lang.String msg)
Just outputs the message on stderr.- Parameters:
msg- the message to output
-
logError
protected void logError(java.lang.String msg, java.lang.Throwable t)Just outputs message and throwable on stderr.- Parameters:
msg- the message to outputt- the exception
-
doRun
protected abstract void doRun()
The actual processing loop.
-
run
public void run()
Reads the data from the process.- Specified by:
runin interfacejava.lang.Runnable
-
-