Package gov.usgs.util

Class TimeoutProcess

java.lang.Object
gov.usgs.util.TimeoutProcess

public class TimeoutProcess extends Object
TimeoutProcess wraps a Process object. It is most commonly used with TimeoutProcessBuilder, which configures the process timeout (and sets the timed out state once the timeout is reached).
See Also:
  • Constructor Details

    • TimeoutProcess

      protected TimeoutProcess(Process process)
      Construct a new TimeoutProcess.
      Parameters:
      process - the wrapped process.
  • Method Details

    • destroy

      public void destroy()
      Destroys a process
    • errorOutput

      public byte[] errorOutput()
      Returns:
      errorOutput byte array
    • exitValue

      public int exitValue()
      Returns:
      exit value
    • getErrorStream

      public InputStream getErrorStream()
      Returns:
      InputStream of error stream
    • getInputStream

      public InputStream getInputStream()
      Returns:
      InputStream
    • getOutputStream

      public OutputStream getOutputStream()
      Returns:
      OutputStream
    • waitFor

      Wait for the process to complete, either normally or because its timeout was reached.
      Returns:
      exitStatus.
      Throws:
      InterruptedException - if thread interruption occurs
      IOException - if IO error occurs
      ProcessTimeoutException - if the process timed out before exiting.
    • setTimeoutElapsed

      protected void setTimeoutElapsed(boolean timeoutElapsed)
      Parameters:
      timeoutElapsed - to set
    • timeoutElapsed

      protected boolean timeoutElapsed()
      Returns:
      timeoutElapsed boolean
    • setTimer

      protected void setTimer(Timer timer)
      Parameters:
      timer - to set