org.eodisp.util.launcher
Interface Process

All Known Implementing Classes:
ProcessImpl

public interface Process

Version:
$Id:$
Author:
ibirrer

Method Summary
 void addEnvVar(java.lang.String key, java.lang.String value)
          Adds the environment variable with the given key and value
 void addListener(ProcessListener processListener)
          Add a listener to this process to get notified of state changes.
 boolean kill(long timeoutInMillis)
          Forcibly kills this process.
 void launch()
          Launches this process.
 int launchBlocking()
          Launches this process and blocks until the process has terminated.
 

Method Detail

launch

void launch()
            throws java.io.IOException
Launches this process. A process cannot be launched twice. A second call to this method will always throw a IllegalStateException.

Throws:
java.io.IOException - thrown if this process could not be launched.
java.lang.IllegalStateException - if this process has already been launched

addEnvVar

void addEnvVar(java.lang.String key,
               java.lang.String value)
Adds the environment variable with the given key and value

Parameters:
key - the key of the environment variable
value - the value of the environment variable

launchBlocking

int launchBlocking()
                   throws java.io.IOException
Launches this process and blocks until the process has terminated.

Throws:
java.io.IOException

kill

boolean kill(long timeoutInMillis)
Forcibly kills this process. This method returns true if this process has been started and is not running anymore (for whatever reason). Returns false if launch() has not been invoked. If this method returns true, it must return true for all subsequent calls to this method. If this method returns false it means that the process is probably still running.

Parameters:
timeoutInMillis - wait at most timeoutInMillis to try to kill the process. A value of 0 means to wait forever.
Returns:
true if the process has been stopped, false if the process is still running or has never been started.

addListener

void addListener(ProcessListener processListener)
Add a listener to this process to get notified of state changes.

Parameters:
processListener -