Class WrapperProcess
- java.lang.Object
-
- org.tanukisoftware.wrapper.WrapperProcess
-
public class WrapperProcess extends java.lang.ObjectA WrapperProcess is returned by a call to WrapperManager.exec and can be used to reference the new child process after it was launched.- Since:
- Wrapper 3.4.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Kills the subprocess.intexitValue()Returns the exit value for the subprocess.protected voidfinalize()Finalize method.java.io.InputStreamgetErrorStream()Gets the error stream of the subprocess.java.io.InputStreamgetInputStream()Gets the input stream of the subprocess.java.io.OutputStreamgetOutputStream()Gets the output stream of the subprocess.intgetPID()Returns the PID of the process.java.io.InputStreamgetStdErr()Gets the error stream of the subprocess.java.io.OutputStreamgetStdIn()Gets the output stream of the subprocess.java.io.InputStreamgetStdOut()Gets the input stream of the subprocess.booleanisAlive()Returns true if the process is still alive.intwaitFor()Causes the current thread to wait, if necessary, until the process represented by this Process object has terminated.
-
-
-
Method Detail
-
finalize
protected void finalize() throws java.lang.ThrowableFinalize method.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
getPID
public int getPID()
Returns the PID of the process.- Returns:
- The PID of the process.
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOExceptionGets the input stream of the subprocess. The stream obtains data piped from the standard output stream of the process represented by this WrapperProcess object.This is an alias of the getStdOut() method.
Implementation note: It is a good idea for the input stream to be buffered.
- Returns:
- The input stream connected to the normal output of the subprocess.
- Throws:
java.io.IOException- If we are unable to access the stream.
-
getStdOut
public java.io.InputStream getStdOut() throws java.io.IOExceptionGets the input stream of the subprocess. The stream obtains data piped from the standard output stream of the process represented by this WrapperProcess object.This is an alias of the getInputStream() method.
Implementation note: It is a good idea for the input stream to be buffered.
- Returns:
- The input stream connected to the normal output of the subprocess.
- Throws:
java.io.IOException- If we are unable to access the stream.
-
getErrorStream
public java.io.InputStream getErrorStream() throws java.io.IOExceptionGets the error stream of the subprocess. The stream obtains data piped from the error output stream of the process represented by this WrapperProcess object.This is an alias of the getStdErr() method.
Implementation note: It is a good idea for the input stream to be buffered.
- Returns:
- The input stream connected to the error stream of the subprocess.
- Throws:
java.io.IOException- If we are unable to access the stream.
-
getStdErr
public java.io.InputStream getStdErr() throws java.io.IOExceptionGets the error stream of the subprocess. The stream obtains data piped from the error output stream of the process represented by this WrapperProcess object.This is an alias of the getErrorStream() method.
Implementation note: It is a good idea for the input stream to be buffered.
- Returns:
- The input stream connected to the error stream of the subprocess.
- Throws:
java.io.IOException- If we are unable to access the stream.
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOExceptionGets the output stream of the subprocess. Output to the stream is piped into the standard input stream of the process represented by this WrapperProcess object.This is an alias of the getStdIn() method.
Implementation note: It is a good idea for the output stream to be buffered.
- Returns:
- The output stream connected to the normal input of the subprocess.
- Throws:
java.io.IOException- If we are unable to access the stream.
-
getStdIn
public java.io.OutputStream getStdIn() throws java.io.IOExceptionGets the output stream of the subprocess. Output to the stream is piped into the standard input stream of the process represented by this WrapperProcess object.This is an alias of the getOutputStream() method.
Implementation note: It is a good idea for the output stream to be buffered.
- Returns:
- The output stream connected to the normal input of the subprocess.
- Throws:
java.io.IOException- If we are unable to access the stream.
-
waitFor
public int waitFor() throws java.lang.InterruptedExceptionCauses the current thread to wait, if necessary, until the process represented by this Process object has terminated. This method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread will be blocked until the subprocess exits.- Returns:
- The exit value of the process. By convention, 0 indicates normal termination.
- Throws:
java.lang.InterruptedException- If the current thread is interrupted by another thread while it is waiting, then the wait is ended and an InterruptedException is thrown.
-
exitValue
public int exitValue() throws java.lang.IllegalThreadStateExceptionReturns the exit value for the subprocess.- Returns:
- The exit value of the subprocess represented by this WrapperProcess object. By convention, the value 0 indicates normal termination.
- Throws:
java.lang.IllegalThreadStateException- if the process is still alive and has not yet teminated.
-
isAlive
public boolean isAlive()
Returns true if the process is still alive.- Returns:
- True if the process is alive, false if it has terminated.
- Throws:
WrapperLicenseError- If the function is called other than in the Professional Edition or from a Standalone JVM.
-
destroy
public void destroy()
Kills the subprocess. The subprocess represented by this Process object is forcibly terminated if it is still running.- Throws:
WrapperLicenseError- If the function is called other than in the Professional Edition or from a Standalone JVM.
-
-