|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uws.job.manager.DefaultExecutionManager
public class DefaultExecutionManager
Default implementation of the ExecutionManager interface.
This manager does not have a queue. That is to say that all jobs are always immediately starting. Consequently this manager is just user to gather all running jobs.
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,AbstractJob> |
runningJobs
List of running jobs. |
Constructor Summary | |
---|---|
DefaultExecutionManager()
Builds an execution manager without queue. |
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()
Always returns 0. |
int |
getNbRunningJobs()
Gets the total number of running jobs. |
java.util.Iterator<AbstractJob> |
getQueuedJobs()
Always returns a Null Iterator (iterator whose next() returns null and hasNext() returns false). |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected transient java.util.Map<java.lang.String,AbstractJob> runningJobs
Constructor Detail |
---|
public DefaultExecutionManager()
sync()
Method Detail |
---|
public void sync()
ExecutionManager
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.
sync
in interface ExecutionManager
public final java.util.Iterator<AbstractJob> getRunningJobs()
ExecutionManager
getRunningJobs
in interface ExecutionManager
public final int getNbRunningJobs()
ExecutionManager
getNbRunningJobs
in interface ExecutionManager
public java.util.Iterator<AbstractJob> getQueuedJobs()
getQueuedJobs
in interface ExecutionManager
ExecutionManager.getQueuedJobs()
public int getNbQueuedJobs()
getNbQueuedJobs
in interface ExecutionManager
ExecutionManager.getNbQueuedJobs()
public void setNoQueue()
ExecutionManager
setNoQueue
in interface ExecutionManager
public boolean hasQueue()
ExecutionManager
hasQueue
in interface ExecutionManager
public void refresh() throws UWSException
ExecutionManager
refresh
in interface ExecutionManager
UWSException
- If there is an error while refreshing this manager.public ExecutionPhase execute(AbstractJob jobToExecute) throws UWSException
ExecutionManager
Lets deciding whether the given job can start immediately or whether it must be put in the queue.
execute
in interface ExecutionManager
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)
public boolean isReadyForExecution(AbstractJob jobToExecute)
ExecutionManager
Tells whether the given job can start immediately its execution or whether it must be put in the queue.
isReadyForExecution
in interface ExecutionManager
jobToExecute
- The job to execute.
public void update(AbstractJob job) throws UWSException
ExecutionManager
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.
update
in interface ExecutionManager
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.public void remove(AbstractJob jobToRemove) throws UWSException
ExecutionManager
remove
in interface ExecutionManager
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 |