Class AbstractProcessRunnable

java.lang.Object
com.github.fracpete.processoutput4j.core.AbstractProcessRunnable
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
AbstractProcessReader

public abstract class AbstractProcessRunnable extends Object implements Runnable
Ancestor for runnables that use a Process object.
  • Field Details

    • m_Queue

      protected BlockingQueue<Process> m_Queue
      the blocking queue for the process.
    • m_Process

      protected Process m_Process
      the process to read from.
    • m_Stopped

      protected boolean m_Stopped
      whether the reader got stopped.
  • Constructor Details

    • AbstractProcessRunnable

      public AbstractProcessRunnable()
      Initializes the reader.
  • Method Details

    • stopExecution

      public void stopExecution()
      Stops the execution.
    • isStopped

      public boolean isStopped()
      Returns whether execution got stopped.
      Returns:
      true if stopped
    • setProcess

      public void setProcess(Process value)
      Sets the process to monitor.
      Parameters:
      value - the process object
    • getProcess

      public Process getProcess()
      Returns the underlying Process object.
      Returns:
      the process object, null if none set
    • logError

      protected void logError(String msg)
      Just outputs the message on stderr.
      Parameters:
      msg - the message to output
    • logError

      protected void logError(String msg, Throwable t)
      Just outputs message and throwable on stderr.
      Parameters:
      msg - the message to output
      t - the exception
    • doRun

      protected abstract void doRun()
      The actual processing loop.
    • run

      public void run()
      Reads the data from the process.
      Specified by:
      run in interface Runnable