Package gov.usgs.util

Class TimeoutProcess


  • public class TimeoutProcess
    extends java.lang.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:
    Process, TimeoutProcessBuilder, ProcessTimeoutException
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected TimeoutProcess​(java.lang.Process process)
      Construct a new TimeoutProcess.
    • Constructor Detail

      • TimeoutProcess

        protected TimeoutProcess​(java.lang.Process process)
        Construct a new TimeoutProcess.
        Parameters:
        process - the wrapped process.
    • Method Detail

      • destroy

        public void destroy()
        Destroys a process
      • errorOutput

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

        public int exitValue()
        Returns:
        exit value
      • getErrorStream

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

        public java.io.InputStream getInputStream()
        Returns:
        InputStream
      • getOutputStream

        public java.io.OutputStream getOutputStream()
        Returns:
        OutputStream
      • waitFor

        public int waitFor()
                    throws java.lang.InterruptedException,
                           java.io.IOException,
                           ProcessTimeoutException
        Wait for the process to complete, either normally or because its timeout was reached.
        Returns:
        exitStatus.
        Throws:
        java.lang.InterruptedException - if thread interruption occurs
        java.io.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​(java.util.Timer timer)
        Parameters:
        timer - to set