Package gov.usgs.util
Class TimeoutProcess
java.lang.Object
gov.usgs.util.TimeoutProcess
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).
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTimeoutProcess(Process process) Construct a new TimeoutProcess. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroys a processbyte[]intprotected voidsetTimeoutElapsed(boolean timeoutElapsed) protected voidprotected booleanintwaitFor()Wait for the process to complete, either normally or because its timeout was reached.
-
Constructor Details
-
TimeoutProcess
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
- Returns:
- InputStream of error stream
-
getInputStream
- Returns:
- InputStream
-
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 occursIOException- if IO error occursProcessTimeoutException- 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
- Parameters:
timer- to set
-