public class DefaultExecutionManager extends java.lang.Object implements ExecutionManager
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 used to gather all running jobs.
Note:
After a call to stopAll()
, this manager is still able to execute new jobs.
Except if it was not possible to stop them properly, stopped jobs could be executed again by calling
afterwards execute(UWSJob)
with these jobs in parameter.
Modifier and Type | Field and Description |
---|---|
protected UWSLog |
logger |
protected java.util.Map<java.lang.String,UWSJob> |
runningJobs
List of running jobs.
|
Constructor and Description |
---|
DefaultExecutionManager() |
DefaultExecutionManager(UWSLog logger) |
Modifier and Type | Method and Description |
---|---|
ExecutionPhase |
execute(UWSJob 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<UWSJob> |
getQueuedJobs()
Always returns a Null Iterator (iterator whose next() returns null and hasNext() returns false).
|
java.util.Iterator<UWSJob> |
getRunningJobs()
Gets the list of running jobs.
|
void |
refresh()
Does nothing in its implementation.
|
void |
remove(UWSJob jobToRemove)
Removes the job from this manager whatever is its current execution phase.
|
void |
stopAll()
Stop all running jobs.
|
protected java.util.Map<java.lang.String,UWSJob> runningJobs
protected final UWSLog logger
public DefaultExecutionManager()
public DefaultExecutionManager(UWSLog logger)
public final java.util.Iterator<UWSJob> getRunningJobs()
ExecutionManager
getRunningJobs
in interface ExecutionManager
public final int getNbRunningJobs()
ExecutionManager
getNbRunningJobs
in interface ExecutionManager
public final java.util.Iterator<UWSJob> getQueuedJobs()
getQueuedJobs
in interface ExecutionManager
ExecutionManager.getQueuedJobs()
public final int getNbQueuedJobs()
getNbQueuedJobs
in interface ExecutionManager
ExecutionManager.getNbQueuedJobs()
public final void refresh()
refresh
in interface ExecutionManager
ExecutionManager.refresh()
public ExecutionPhase execute(UWSJob jobToExecute)
ExecutionManager
Lets deciding whether the given job can start immediately or whether it must be put in the queue.
Note: If any error occurs while executing the given job, it SHOULD be logged using the service logger.
execute
in interface ExecutionManager
jobToExecute
- The job to execute.UWSJob.start(boolean)
,
UWSJob.setPhase(ExecutionPhase)
public void remove(UWSJob jobToRemove)
ExecutionManager
Removes the job from this manager whatever is its current execution phase.
Note: If any error occurs while removing a job from this manager, it SHOULD be logged using the service logger.
remove
in interface ExecutionManager
jobToRemove
- The job to remove.public void stopAll()
ExecutionManager
Stop all running jobs. No more job, even the queued ones, must be executed after a call to this function. All stopped or aborted queued jobs should be set forcedly back to the PENDING status.
Note:
A call to ExecutionManager.execute(UWSJob)
would re-activate this manager. However jobs stopped or
aborted using this function might not be starting again. These behaviors at implementation-dependent.
stopAll
in interface ExecutionManager