uws.service
Class QueuedExtendedUWS

java.lang.Object
  extended by uws.job.SerializableUWSObject
      extended by uws.service.AbstractUWS<JobList<AbstractJob>,AbstractJob>
          extended by uws.service.ExtendedUWS
              extended by uws.service.QueuedExtendedUWS
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<JobList<AbstractJob>>, java.util.EventListener, javax.servlet.http.HttpSessionBindingListener

public class QueuedExtendedUWS
extends ExtendedUWS

A ExtendedUWS which is able to manage an execution queue. In this implementation the size of the queue is limited by a number given at the initialization. Thus a job can run in this UWS only if there are less running jobs than the given number.

Note: The limitation of the queue size is only one possible queue management way ! If you want to test other conditions before running a job, you must change the used execution manager by using the method AbstractUWS.setExecutionManager(ExecutionManager) with the appropriate implementation of the interface ExecutionManager.

Version:
02/2011
Author:
Grégory Mantelet (CDS)
See Also:
ExtendedUWS, QueuedExecutionManager, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class uws.service.ExtendedUWS
ExtendedUWS.AddJobWithConstructor
 
Field Summary
 
Fields inherited from class uws.service.ExtendedUWS
assocJobListClass, assocJobListConstructor, jlDestination
 
Fields inherited from class uws.service.AbstractUWS
choosenSerializer, defaultSerializer, description, executedAction, homePage, homeRedirection, mapJobLists, name, reInitUrlInterpreter, serializers, urlInterpreter, userIdentifier, uwsActions
 
Constructor Summary
QueuedExtendedUWS(int nbMaxRunningJobs)
          Builds a QueuedExtendedUWS.
QueuedExtendedUWS(int nbMaxRunningJobs, java.lang.String baseURI)
          Builds a QueuedExtendedUWS with its base URI.
QueuedExtendedUWS(int nbMaxRunningJobs, UWSUrl urlInterpreter)
          Builds a QueuedExtendedUWS with the UWS URL interpreter to use.
 
Method Summary
 int getMaxRunningJobs()
          Gets the maximum number of jobs that can run in the same time.
 void setMaxRunningJobs(int maxRunningJobs)
          Sets the maximum number of jobs that can run in the same time.
 
Methods inherited from class uws.service.ExtendedUWS
addConstructor, addJobList, createJob, destroyJobList, getConstructor, removeJobList
 
Methods inherited from class uws.service.AbstractUWS
addJobList, addSerializer, addUWSAction, addUWSAction, destroyAllJobLists, destroyJobList, executeRequest, getBaseURI, getChoosenSerializer, getDefaultSerializer, getDescription, getDestructionManager, getDestructionTimeController, getExecutedAction, getExecutionDurationController, getExecutionManager, getHomePage, getJobList, getName, getNbJobList, getNbSerializers, getNbUWSActions, getSerializer, getSerializers, getUrlInterpreter, getUserIdentifier, getUWSAction, getUWSActions, getXsltURL, hasSerializerFor, isDefaultHomePage, isHomePageRedirection, iterator, redirect, removeAllJobLists, removeJobList, removeSerializer, removeUWSAction, removeUWSAction, replaceUWSAction, sendError, sendError, serialize, setDefaultHomePage, setDefaultSerializer, setDescription, setDestructionManager, setDestructionTimeController, setExecutionDurationController, setExecutionManager, setHomePage, setHomePage, setName, setUrlInterpreter, setUserIdentifier, setUWSAction, setXsltURL, sync, valueBound, valueUnbound
 
Methods inherited from class uws.job.SerializableUWSObject
serialize, serialize, serialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueuedExtendedUWS

public QueuedExtendedUWS(int nbMaxRunningJobs)
                  throws UWSException
Builds a QueuedExtendedUWS.

Parameters:
nbMaxRunningJobs - The maximum number of jobs that can run in the same time (that is to say: the size of the execution queue).
Throws:
UWSException - If there is an error when calling the constructor super() or if the given maximum number of running jobs is negative or null.
See Also:
ExtendedUWS.ExtendedUWS(), QueuedExecutionManager.QueuedExecutionManager(int), AbstractUWS.setExecutionManager(uws.job.manager.ExecutionManager)

QueuedExtendedUWS

public QueuedExtendedUWS(int nbMaxRunningJobs,
                         java.lang.String baseURI)
                  throws UWSException
Builds a QueuedExtendedUWS with its base URI.

Parameters:
nbMaxRunningJobs - The maximum number of jobs that can run in the same time (that is to say: the size of the execution queue).
baseURI - The base UWS URI.
Throws:
UWSException - If there is an error when calling the constructor super(String) or if the given maximum number of running jobs is negative or null.
See Also:
ExtendedUWS.ExtendedUWS(String), QueuedExecutionManager.QueuedExecutionManager(int), AbstractUWS.setExecutionManager(uws.job.manager.ExecutionManager)

QueuedExtendedUWS

public QueuedExtendedUWS(int nbMaxRunningJobs,
                         UWSUrl urlInterpreter)
                  throws UWSException
Builds a QueuedExtendedUWS with the UWS URL interpreter to use.

Parameters:
nbMaxRunningJobs - The maximum number of jobs that can run in the same time (that is to say: the size of the execution queue).
urlInterpreter - The UWS URL interpreter this UWS must use.
Throws:
UWSException - If there is an error when calling the constructor super(UWSUrl) of if the given maximum number of running jobs is negative or null.
See Also:
ExtendedUWS.ExtendedUWS(UWSUrl), QueuedExecutionManager.QueuedExecutionManager(int), AbstractUWS.setExecutionManager(uws.job.manager.ExecutionManager)
Method Detail

getMaxRunningJobs

public final int getMaxRunningJobs()

Gets the maximum number of jobs that can run in the same time.

Note: This method does nothing if the used execution manager is not subclass of QueuedExecutionManager.

Returns:
The maximum number of running jobs or a negative value if the used execution manager is not a subclass of QueuedExecutionManager.
See Also:
QueuedExecutionManager.getMaxRunningJobs()

setMaxRunningJobs

public final void setMaxRunningJobs(int maxRunningJobs)
                             throws UWSException

Sets the maximum number of jobs that can run in the same time.

Note: This method does nothing if the used execution manager is not subclass of QueuedExecutionManager.

Parameters:
maxRunningJobs - The new maximum number of running jobs (must be > 0 to have a queue).
Throws:
UWSException - If there is an error while updating the list of running jobs (in other words if some queued jobs can not be executed).
See Also:
QueuedExecutionManager.setMaxRunningJobs(int)