Class WrapperProcess
- java.lang.Object
-
- org.tanukisoftware.wrapper.WrapperProcess
-
public class WrapperProcess extends java.lang.Object
A 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 void
destroy()
Kills the subprocess.int
exitValue()
Returns the exit value for the subprocess.protected void
finalize()
Finalize method.java.io.InputStream
getErrorStream()
Gets the error stream of the subprocess.java.io.InputStream
getInputStream()
Gets the input stream of the subprocess.java.io.OutputStream
getOutputStream()
Gets the output stream of the subprocess.int
getPID()
Returns the PID of the process.java.io.InputStream
getStdErr()
Gets the error stream of the subprocess.java.io.OutputStream
getStdIn()
Gets the output stream of the subprocess.java.io.InputStream
getStdOut()
Gets the input stream of the subprocess.boolean
isAlive()
Returns true if the process is still alive.int
waitFor()
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.Throwable
Finalize method.- Overrides:
finalize
in 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.IOException
Gets 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.IOException
Gets 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.IOException
Gets 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.IOException
Gets 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.IOException
Gets 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.IOException
Gets 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.InterruptedException
Causes 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.IllegalThreadStateException
Returns 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.
-
-