Rio Project 4.2 API Documentation



org.rioproject.exec
Class ProcessManager

java.lang.Object
  extended by org.rioproject.exec.ProcessManager
Direct Known Subclasses:
PosixProcessManager

public abstract class ProcessManager
extends Object

Provides a wrapper around a process, including the pid of the started process as well as other helpful information

Author:
Dennis Reedy

Nested Class Summary
static interface ProcessManager.Listener
          Notification for Process termination
 
Constructor Summary
ProcessManager(Process process, int pid)
          Create a ProcessManager
 
Method Summary
abstract  void destroy(boolean includeChildren)
          Destroy the managed process
 int getPid()
          Get the pid
 Process getProcess()
          Get the Process the ProcessManager is managing
abstract  void manage()
          Manage the Process
protected  void notifyOnTermination()
          Notify all ProcessManager.Listeners of the process termination
 void registerListener(ProcessManager.Listener l)
          Register a ProcessManager.Listener
 void unregisterListener(ProcessManager.Listener l)
          Unregister a ProcessManager.Listener
abstract  void waitFor()
          Waits for the process to exit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessManager

public ProcessManager(Process process,
                      int pid)
Create a ProcessManager

Parameters:
process - The Process the ProcessManager will manage
pid - The process ID of the started Process
Method Detail

getProcess

public Process getProcess()
Get the Process the ProcessManager is managing

Returns:
The Process

getPid

public int getPid()
Get the pid

Returns:
The pid

registerListener

public void registerListener(ProcessManager.Listener l)
Register a ProcessManager.Listener

Parameters:
l - The listener to register

unregisterListener

public void unregisterListener(ProcessManager.Listener l)
Unregister a ProcessManager.Listener

Parameters:
l - The listener to unregister

notifyOnTermination

protected void notifyOnTermination()
Notify all ProcessManager.Listeners of the process termination


manage

public abstract void manage()
                     throws IOException
Manage the Process

Throws:
IOException - if the process management utility cannot be created

destroy

public abstract void destroy(boolean includeChildren)
Destroy the managed process

Parameters:
includeChildren - If true, destroy all child processes asl well. This method will look for all child processes that have a prent process ID of the managed process and forcibly terminate them.

waitFor

public abstract void waitFor()
Waits for the process to exit


Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.