org.javagroup.process
Interface JProcess

All Known Implementing Classes:
StandardJProcess

public abstract interface JProcess

An interface for classes representing processes inside the JVM.


Field Summary
static int DEAD
          State constant.
static int RUNNING
          State constant.
static int UNSTARTED
          State constant.
 
Method Summary
 java.lang.ClassLoader getClassLoader()
          Return the ClassLoader that was used to load the classes for this process.
 java.lang.String getName()
          Gets the name of this process.
 long getPid()
          Gets the unique ID number for the process.
 int getState()
          Get the state of the process.
 java.lang.ThreadGroup getThreadGroup()
          Return the ThreadGroup for this JProcess.
 void kill()
          Kill the process.
 void launch()
          Set the process running on its own Thread.
 void registerAndBindToResource(Resource resource)
          Binds the process to a resource.
 void registerResource(Resource resource)
          Binds a given resource the the process.
 

Field Detail

UNSTARTED

public static final int UNSTARTED
State constant.

RUNNING

public static final int RUNNING
State constant.

DEAD

public static final int DEAD
State constant.
Method Detail

getName

public java.lang.String getName()
Gets the name of this process.
Returns:
The process name.

getPid

public long getPid()
Gets the unique ID number for the process.
Returns:
JProcess ID.

launch

public void launch()
Set the process running on its own Thread.

getState

public int getState()
Get the state of the process.
Returns:
the state, matching one of the state constants

getThreadGroup

public java.lang.ThreadGroup getThreadGroup()
Return the ThreadGroup for this JProcess. All Threads belonging to the process must be members of this ThreadGroup, or of its children
Returns:
The process ThreadGroup.

getClassLoader

public java.lang.ClassLoader getClassLoader()
Return the ClassLoader that was used to load the classes for this process.
Returns:
The ClassLoader used, or null if not appropriate.

kill

public void kill()
Kill the process.

registerResource

public void registerResource(Resource resource)
Binds a given resource the the process. The process will lock the resource, and release the lock upon process death.
Parameters:
resource - The resource to bind to the process.

registerAndBindToResource

public void registerAndBindToResource(Resource resource)
Binds the process to a resource. The process will lock the resource, but the process will not be garbage collected while the resource is valid, or it is explicitly killed. When the process dies, it will release it's lock on the resource.
Parameters:
resource - The resource to bind the process to.
See Also:
kill()