public class Process2
extends java.lang.Object
Constructor and Description |
---|
Process2(java.lang.Process process)
Default constructor allowing process cleanup on JVM Shutdown.
|
Process2(java.lang.Process process,
boolean no_shutdown_hook)
Alternate constructor to allow the prevention of cleanup on JVM Shutdown.
|
Modifier and Type | Method and Description |
---|---|
Process2 |
connectStderr(java.lang.Appendable sink) |
Process2 |
connectStdin(java.io.InputStream source) |
Process2 |
connectStdin(java.lang.Readable source) |
Process2 |
connectStdout(java.lang.Appendable sink) |
void |
destroy()
destroy() the underlying process IF the flag to persist beyond shutdown is not set.
|
Process2 |
discardStderr()
Connects Stderr to the internal DEV_NULL sink.
|
Process2 |
discardStdout()
Connects Stdout to the internal DEV_NULL sink.
|
int |
exitValue()
Returns the exit value for the subprocess.
|
Process2 |
forwardIO()
Forward Process Stdin to System.in
Also invokes forwardOutput
|
Process2 |
forwardOutput()
Forward Process StdOut to System.out and forward StdErr to System.err.
|
java.lang.Process |
getProcess() |
java.io.InputStream |
getStderr() |
java.io.BufferedReader |
getStderrReader() |
java.io.OutputStream |
getStdin() |
java.io.Writer |
getStdinWriter() |
java.io.InputStream |
getStdout() |
java.io.BufferedReader |
getStdoutReader() |
void |
removeJVMShutdownReference()
Remove this process from the JVM Shutdown Hook thread.
|
void |
setPersist(boolean doPersist)
Change the persist status of this process.
|
Process2 |
waitFor()
Wait/Block for the exitValue/completion from the wrapped Process.
|
Process2 |
waitFor(int secsTimeout)
Wait/Block for the exitValue/completion from the wrapped Process up to
the provided secsTimeout period.
|
Process2 |
waitForSuccess()
Wait for exitValue (0) from the wrapped Process.
|
Process2 |
waitForSuccess(int secsTimeout)
Wait for exitValue (0) from the wrapped Process within the specified timeout period.
|
public Process2(java.lang.Process process)
process
- object to wrappublic Process2(java.lang.Process process, boolean no_shutdown_hook)
process
- object to wrapno_shutdown_hook
- -- true to persist the process beyond JVM shutdown.persist
public void setPersist(boolean doPersist)
doPersist
- public void destroy()
persist
public void removeJVMShutdownReference()
public int exitValue()
java.lang.IllegalThreadStateException
- - if the subprocess represented by this Process object has not yet terminated.public Process2 waitFor() throws java.lang.InterruptedException
java.lang.InterruptedException
- if thrown by the underlying process.Process.waitFor()
public Process2 waitFor(int secsTimeout) throws java.lang.InterruptedException
secsTimeout
- -- number of seconds to wait before issuing IllegalThreadStateException.java.lang.InterruptedException
- if thrown by the underlying process.java.lang.IllegalThreadStateException
- if the timeout has been reached without the
process having exited.public Process2 waitForSuccess() throws java.lang.InterruptedException
java.lang.InterruptedException
- if thrown by the underlying process.java.lang.RuntimeException
- if the exitValue is NOT 0 (success).waitFor()
,
Process.waitFor()
public Process2 waitForSuccess(int secsTimeout) throws java.lang.InterruptedException
secsTimeout
- -- number of seconds to wait before issuing an IllegalThreadStateException.java.lang.InterruptedException
- if thrown by the underlying process.java.lang.RuntimeException
- if the exitValue is NOT 0 (success).java.lang.IllegalThreadStateException
- if the timeout is reached without process termination.waitFor(int)
public java.lang.Process getProcess()
public java.io.OutputStream getStdin()
public java.io.Writer getStdinWriter()
public java.io.InputStream getStdout()
public java.io.BufferedReader getStdoutReader()
public java.io.InputStream getStderr()
public java.io.BufferedReader getStderrReader()
public Process2 connectStdin(java.lang.Readable source)
public Process2 connectStdin(java.io.InputStream source)
public Process2 connectStdout(java.lang.Appendable sink)
public Process2 connectStderr(java.lang.Appendable sink)
public Process2 discardStdout()
connectStdout(Appendable)
public Process2 discardStderr()
connectStderr(Appendable)
public Process2 forwardIO()
forwardOutput()
public Process2 forwardOutput()
Copyright © SAS Institute. All Rights Reserved.