public interface DestructionManager
extends java.io.Serializable
Manages the automatic destruction of given jobs.
Any job has a field named: destruction. It indicates when the job must be destroyed. Remember that destroying a job means clearing all its resources (stopping it, deleting its result, ...) and removing it from its jobs list.
Each job must warn its jobs list of any change of its destruction time,
so that the jobs list can update the destruction manager with the method update(UWSJob)
.
Once the destruction time of a job is reached, it must be removed from this manager and
from its jobs list (see JobList.destroyJob(String)
).
Note:
DefaultDestructionManager
is a default implementation of this interface.
It is used by default by any subclass of UWS
and JobList
.
DefaultDestructionManager
Modifier and Type | Method and Description |
---|---|
int |
getNbJobsToDestroy()
Gets the total number of jobs planned to be destroyed.
|
java.util.Date |
getNextDestruction()
Gets the destruction date/time of the job currently planned for destruction.
|
java.lang.String |
getNextJobToDestroy()
Gets the ID of the job currently planned for destruction.
|
boolean |
isRunning()
Indicates whether a job is currently planned to be destroyed.
|
void |
refresh()
Refresh the list of jobs to destroy.
|
void |
remove(UWSJob job)
Removes the given job from this manager.
|
void |
stop()
Stop watching the destruction of jobs.
|
void |
update(UWSJob job)
Updates the list of jobs to destroy with the given job.
|
boolean isRunning()
java.util.Date getNextDestruction()
java.lang.String getNextJobToDestroy()
int getNbJobsToDestroy()
void refresh()
Refresh the list of jobs to destroy.
It may stop if there is not any more job to destroy. It may change the currently planned job if another job must be destroyed before it.
void update(UWSJob job)
Updates the list of jobs to destroy with the given job.
refresh()
).job
- The job whose the destruction time may have changed.void remove(UWSJob job)
job
- The job to remove.void stop()
Stop watching the destruction of jobs.
Note:
A subsequent call to update(UWSJob)
may enable again this manager.