|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.jini.mahalo.Job
public abstract class Job
A Job
manages the division of work for a problem
whose solution is obtained by assembling partial results to
original problem.
Field Summary | |
---|---|
(package private) int[] |
attempts
|
(package private) static Logger |
logger
|
private int |
pending
|
private TaskManager |
pool
|
(package private) Object[] |
results
|
private Map |
tasks
|
private WakeupManager |
wm
|
Constructor Summary | |
---|---|
Job(TaskManager pool,
WakeupManager wm)
Create the Job object giving it the
TaskManager responsible for the pool of
threads which perform the necessary work. |
Method Summary | |
---|---|
(package private) int |
attempt(TaskManager.Task who)
Given a TaskManager.Task , this method
returns the current number of attempts it has made. |
private void |
awaitPending(long waitFor)
|
(package private) abstract Object |
computeResult()
Generate the solution to the original problem. |
(package private) abstract TaskManager.Task[] |
createTasks()
Create the tasks required to compute all of the PartialResult objects necessary for the
solution to the original problem. |
private void |
decrementPending()
|
(package private) abstract Object |
doWork(TaskManager.Task who,
Object param)
The work performed is implemented here. |
protected WakeupManager |
getMgr()
Returns a reference to the WakeupManager which
provides the scheduling of tasks created by
this Job |
protected TaskManager |
getPool()
Returns a reference to the TaskManager which
supplies the threads used to executed tasks created by
this Job |
boolean |
isCompleted(long waitFor)
Check to see if the Job execution has
completed. |
(package private) boolean |
performWork(TaskManager.Task who,
Object param)
Used by a task to do a piece of work and record the number of attempts. |
private void |
reportDone(TaskManager.Task who,
Object param)
|
void |
scheduleTasks()
Schedules tasks for execution |
private void |
setPending(int num)
|
void |
stop()
Halt all of the work being performed by the Job |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private TaskManager pool
private WakeupManager wm
private int pending
Object[] results
int[] attempts
private Map tasks
static final Logger logger
Constructor Detail |
---|
public Job(TaskManager pool, WakeupManager wm)
Job
object giving it the
TaskManager
responsible for the pool of
threads which perform the necessary work.
pool
- the TaskManager
which provides the threadsMethod Detail |
---|
boolean performWork(TaskManager.Task who, Object param) throws JobException
who
- The task which is performing the workparam
- A parameter used in performing the work
JobException
int attempt(TaskManager.Task who) throws JobException
TaskManager.Task
, this method
returns the current number of attempts it has made.
who
- The task for which the number of attempts
is inquired
JobException
abstract Object doWork(TaskManager.Task who, Object param) throws JobException
who
- The task performing the workparam
- A parameter used to do the work
JobException
abstract TaskManager.Task[] createTasks()
PartialResult
objects necessary for the
solution to the original problem.
public void scheduleTasks()
private void awaitPending(long waitFor)
private void setPending(int num)
private void decrementPending()
protected TaskManager getPool()
TaskManager
which
supplies the threads used to executed tasks created by
this Job
protected WakeupManager getMgr()
WakeupManager
which
provides the scheduling of tasks created by
this Job
private void reportDone(TaskManager.Task who, Object param) throws JobException
JobException
public boolean isCompleted(long waitFor) throws JobException
Job
execution has
completed.
waitFor
- The amount of time the caller is willing
to wait for the completion status to arrive.
JobException
abstract Object computeResult() throws JobException
JobException
public void stop()
Job
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |