uPortal 2.4.1
API Documentation

org.jasig.portal.utils.threading
Class WorkerTask

java.lang.Object
  extended byorg.jasig.portal.utils.threading.WorkerTask
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
StatsRecorderWorkerTask

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

The WorkerTask class should be extended by any class that will be executed by a ThreadPool.

Version:
$Revision: 1.2 $
Author:
Chad La Joie

Constructor Summary
WorkerTask()
           
 
Method Summary
 void deregisterTracker()
          Disassociates the WorkerTracker associated with this task.
 java.lang.Exception getException()
          Returns the exception thrown in the run method, assuming it was set using setException
 Worker getWorker()
          Gets the worker associated with this task
 WorkTracker getWorkTracker()
          Gets the WorkTracker associated with this task
 boolean hasException()
          Checks if this task has had an exception
 void kill()
          Kills this task
abstract  void run()
          The work of a WorkerTask
 void setException(java.lang.Exception e)
          Should be called in the run method to set an exception that occured while executing
 void setWorker(Worker worker)
          Sets the worker associated with this task
 void setWorkTracker(WorkTracker tracker)
          Sets the tracker associated with this task
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkerTask

public WorkerTask()
Method Detail

run

public abstract void run()
The work of a WorkerTask

Specified by:
run in interface java.lang.Runnable

setException

public void setException(java.lang.Exception e)
Should be called in the run method to set an exception that occured while executing

Parameters:
e - the exception encountered in the run method

getException

public final java.lang.Exception getException()
Returns the exception thrown in the run method, assuming it was set using setException

Returns:
the exception thrown in the run method, or null if there was, or it wasn't set

setWorker

public final void setWorker(Worker worker)
Sets the worker associated with this task

Parameters:
worker - the Worker currently performing this task

getWorker

public final Worker getWorker()
Gets the worker associated with this task

Returns:
the Worker currently performing this task

setWorkTracker

public final void setWorkTracker(WorkTracker tracker)
Sets the tracker associated with this task

Parameters:
tracker - The WorkTracker associated with this task

getWorkTracker

public final WorkTracker getWorkTracker()
Gets the WorkTracker associated with this task

Returns:
the WorkTracker associated with this task

hasException

public final boolean hasException()
Checks if this task has had an exception

Returns:
true if an exception has been set using setException(), false if not

deregisterTracker

public final void deregisterTracker()
Disassociates the WorkerTracker associated with this task. This method should never be used, except by the Worker thread


kill

public final void kill()
Kills this task


uPortal 2.4.1
API Documentation