uPortal 2.4.1
API Documentation

org.jasig.portal.utils.threading
Class WorkTracker

java.lang.Object
  extended byorg.jasig.portal.utils.threading.WorkTracker

public final class WorkTracker
extends java.lang.Object

This class allows WorkerTasks to be tracked and stopped.

Version:
$Revision: 1.3 $
Author:
Field Summary
static int DONE
           
static int KILLED
           
static int READY
           
static int RUNNING
           
 
Constructor Summary
WorkTracker(WorkerTask task)
          WorkTracker Constructor
 
Method Summary
 void deregisterWork()
          De-associated this tracker with it's current task.
 java.lang.Exception getException()
          Gets the exception encountered by the task this tracker is associated with
 int getState()
          Gets the state of the task associated with this tracker
 boolean isJobComplete()
          Checks to see if the task associated with this tracker is complete
 boolean isJobSuccessful()
          Checks if task this tracker is associated with has completed successfully Note, a job will never have a chance to be successful until it has completed.
 void killJob()
          Kills the task associated with tracker
 java.lang.String toString()
          Returns a string representaiton of this task giving it's state, the job success status, and the exception if there is any.
 void updateStatus(int state, boolean succcessful, java.lang.Exception exception)
          Updates the status of this tracker, and notifies all threads waiting on this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

READY

public static final int READY
See Also:
Constant Field Values

RUNNING

public static final int RUNNING
See Also:
Constant Field Values

DONE

public static final int DONE
See Also:
Constant Field Values

KILLED

public static final int KILLED
See Also:
Constant Field Values
Constructor Detail

WorkTracker

public WorkTracker(WorkerTask task)
WorkTracker Constructor

Parameters:
task - the task this tracker is associated with
Method Detail

updateStatus

public void updateStatus(int state,
                         boolean succcessful,
                         java.lang.Exception exception)
Updates the status of this tracker, and notifies all threads waiting on this object.

Parameters:
state - the current state of the task associated with this tracker
succcessful - whether the task associated with this tracker has been completed succesfully
exception - the exception thrown by the task associated with this tracker

killJob

public void killJob()
Kills the task associated with tracker


getException

public java.lang.Exception getException()
Gets the exception encountered by the task this tracker is associated with

Returns:
the exception encountered by the task this tracker is associated with

isJobSuccessful

public boolean isJobSuccessful()
Checks if task this tracker is associated with has completed successfully Note, a job will never have a chance to be successful until it has completed.

Returns:
true if the task has completed successfully, false if not

isJobComplete

public boolean isJobComplete()
Checks to see if the task associated with this tracker is complete

Returns:
true if the task associated with this tracker is complete, false if not

getState

public int getState()
Gets the state of the task associated with this tracker

Returns:
the state of the task associated with this tracker

deregisterWork

public void deregisterWork()
De-associated this tracker with it's current task. This method should never be used, except by the Worker thread


toString

public java.lang.String toString()
Returns a string representaiton of this task giving it's state, the job success status, and the exception if there is any.

Returns:
a string representaiton of this task

uPortal 2.4.1
API Documentation