org.tanukisoftware.wrapper
Class WrapperProcess

java.lang.Object
  extended by org.tanukisoftware.wrapper.WrapperProcess

public class WrapperProcess
extends 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
Author:
Leif Mortenson

Method Summary
 void destroy()
          Kills the subprocess.
 int exitValue()
          Returns the exit value for the subprocess.
protected  void finalize()
          Finalize method.
 InputStream getErrorStream()
          Gets the error stream of the subprocess.
 InputStream getInputStream()
          Gets the input stream of the subprocess.
 OutputStream getOutputStream()
          Gets the output stream of the subprocess.
 int getPID()
          Returns the PID of the process.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

finalize

protected void finalize()
                 throws Throwable
Finalize method.

Overrides:
finalize in class Object
Throws:
Throwable

getPID

public int getPID()
Returns the PID of the process.

Returns:
The PID of the process.

getInputStream

public InputStream getInputStream()
                           throws 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.

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:
IOException - If we are unable to access the stream.

getErrorStream

public InputStream getErrorStream()
                           throws 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.

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:
IOException - If we are unable to access the stream.

getOutputStream

public OutputStream getOutputStream()
                             throws 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.

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:
IOException - If we are unable to access the stream.

waitFor

public int waitFor()
            throws 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:
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 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:
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.


Copyright 1999, 2010 Tanuki Software Inc., All Rights Reserved.