org.ispheres.shared.process
Class ProcessHandle

java.lang.Object
  extended by org.ispheres.shared.process.ProcessHandle
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
Process, Search

public abstract class ProcessHandle
extends java.lang.Object
implements java.lang.Runnable

This class acts as a handle to processes (tasks), it stores information about when a process was started how long it has been idle for (i.e. how long since a client has checked in on its progress).

Author:
Clinton Freeman mochumbo@users.sourceforge.net, Ted Zhou

Constructor Summary
ProcessHandle(int h)
          Constructor - This function creates a new process handle.
 
Method Summary
protected  void accessHandle()
          This function is used by implementing subclasses to access the process handle and set when the handle was last accessed.
 void close()
          This function is used by nice clients to indicate that they have finished with the process and that it can be removed from the system.
protected  void complete()
          This is used to flag a ProcessHandle as being completed.
 long getElapsedTime()
           
 int getHandle()
           
 long getIdleTime()
          This function returns the time that this process handle has been idle, this is essentially the time since the process handle has been accessed.
 boolean isClosed()
           
 boolean isCompleted()
           
abstract  void run()
          This function must be implemented by subclasses, it invokes the process (task) that needs to be performed.
protected  void startHandle()
          A process may sit in a FutureTask waiting list before being actually performed This function should be called at the start of the execute block to initialise timers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessHandle

public ProcessHandle(int h)
Constructor - This function creates a new process handle.

Parameters:
h - The int value to use for the unique id.
Method Detail

accessHandle

protected final void accessHandle()
This function is used by implementing subclasses to access the process handle and set when the handle was last accessed.


close

public final void close()
This function is used by nice clients to indicate that they have finished with the process and that it can be removed from the system.


complete

protected final void complete()
This is used to flag a ProcessHandle as being completed.


getElapsedTime

public final long getElapsedTime()
Returns:
The number of milliseconds since the process handle was created.

getHandle

public final int getHandle()
Returns:
This returns the unique identifier for the ProcessHandle.

getIdleTime

public final long getIdleTime()
This function returns the time that this process handle has been idle, this is essentially the time since the process handle has been accessed.

Returns:
The number of milliseconds since the process handle had been accessed last.

isClosed

public final boolean isClosed()
Returns:
This returns true if the ProcessHandle has been closed and that resources it uses can be re-allocated.

isCompleted

public final boolean isCompleted()
Returns:
This returns true if the ProcessHandle finished succesfully. Otherwise false is returned.

run

public abstract void run()
This function must be implemented by subclasses, it invokes the process (task) that needs to be performed.

Specified by:
run in interface java.lang.Runnable

startHandle

protected final void startHandle()
A process may sit in a FutureTask waiting list before being actually performed This function should be called at the start of the execute block to initialise timers.



Copyright © 2004-2005 The Archaeological Computing Laboratory, University of Sydney. All Rights Reserved.