uws.job.manager
Interface DestructionManager

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
DefaultDestructionManager

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(AbstractJob). 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 AbstractUWS and JobList.

Version:
02/2011
Author:
Grégory Mantelet (CDS)
See Also:
DefaultDestructionManager

Method Summary
 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(AbstractJob job)
          Removes the given job from this manager.
 void update(AbstractJob job)
          Updates the list of jobs to destroy with the given job.
 

Method Detail

isRunning

boolean isRunning()
Indicates whether a job is currently planned to be destroyed.

Returns:
true if a destruction is currently planned, false otherwise.

getNextDestruction

java.util.Date getNextDestruction()
Gets the destruction date/time of the job currently planned for destruction.

Returns:
The time of the currently planned destruction.

getNextJobToDestroy

java.lang.String getNextJobToDestroy()
Gets the ID of the job currently planned for destruction.

Returns:
The ID of the job to destroy.

getNbJobsToDestroy

int getNbJobsToDestroy()
Gets the total number of jobs planned to be destroyed.

Returns:
The jobs to destroy.

refresh

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.


update

void update(AbstractJob job)

Updates the list of jobs to destroy with the given job.

Parameters:
job - The job whose the destruction time may have changed.

remove

void remove(AbstractJob job)
Removes the given job from this manager. If the given job is the currently planned job to destroy, the manager is then refreshed.

Parameters:
job - The job to remove.