|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ExecutionManager
Lets managing the execution of a set of jobs.
It is used by a job to decide whether it can be executed or whether it must be put in a queue.
This decision is done by the function isReadyForExecution(AbstractJob)
when execute(AbstractJob)
is called.
Besides the job must notify its manager when it is asked to start (execute(AbstractJob)
)
and to end (remove(AbstractJob)
).
Note: update(AbstractJob)
is used only when the job is changing its execution manager while executing.
Method Summary | |
---|---|
ExecutionPhase |
execute(AbstractJob jobToExecute)
Lets deciding whether the given job can start immediately or whether it must be put in the queue. |
int |
getNbQueuedJobs()
Gets the total number of queued jobs. |
int |
getNbRunningJobs()
Gets the total number of running jobs. |
java.util.Iterator<AbstractJob> |
getQueuedJobs()
Gets the list of queued jobs. |
java.util.Iterator<AbstractJob> |
getRunningJobs()
Gets the list of running jobs. |
boolean |
hasQueue()
Indicates whether this execution manager has a queue or not. |
boolean |
isReadyForExecution(AbstractJob jobToExecute)
Tells whether the given job can start immediately its execution or whether it must be put in the queue. |
void |
refresh()
Refreshes the lists of running and queued jobs. |
void |
remove(AbstractJob jobToRemove)
Removes the job from this manager whatever is its current execution phase. |
void |
setNoQueue()
Lets indicating that no more jobs must be put in the queue. |
void |
sync()
This method is called just after a de-serialization. |
void |
update(AbstractJob job)
Puts the given job into the appropriate list of jobs: if EXECUTING , the job must be put in the list of running jobs,
but if QUEUED , it must be put into the queue. |
Method Detail |
---|
void sync()
This method is called just after a de-serialization. It resets all: just after a de-serialization there is no running jobs so all jobs lists are cleared.
java.util.Iterator<AbstractJob> getRunningJobs()
int getNbRunningJobs()
java.util.Iterator<AbstractJob> getQueuedJobs()
int getNbQueuedJobs()
void setNoQueue()
boolean hasQueue()
void refresh() throws UWSException
UWSException
- If there is an error while refreshing this manager.ExecutionPhase execute(AbstractJob jobToExecute) throws UWSException
Lets deciding whether the given job can start immediately or whether it must be put in the queue.
jobToExecute
- The job to execute.
UWSException
- If there is an error while changing the execution phase of the given job or if any other error occurs.AbstractJob.start(boolean)
,
AbstractJob.setPhase(ExecutionPhase)
boolean isReadyForExecution(AbstractJob jobToExecute)
Tells whether the given job can start immediately its execution or whether it must be put in the queue.
jobToExecute
- The job to execute.
void update(AbstractJob job) throws UWSException
Puts the given job into the appropriate list of jobs: if EXECUTING
, the job must be put in the list of running jobs,
but if QUEUED
, it must be put into the queue. In another case, nothing is done except refreshing the list of running jobs.
job
- The job to "add" to this manager.
UWSException
- If there is an error while refreshing the list of running jobs or if any other error occurs.void remove(AbstractJob jobToRemove) throws UWSException
jobToRemove
- The job to remove.
UWSException
- If there is an error while refreshing the list of running jobs or if any other error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |