uws.service
Class QueuedBasicUWS<J extends AbstractJob>

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

public class QueuedBasicUWS<J extends AbstractJob>
extends BasicUWS<J>

A BasicUWS 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:
BasicUWS, QueuedExecutionManager, Serialized Form

Field Summary
 
Fields inherited from class uws.service.BasicUWS
constructor, jobClass
 
Fields inherited from class uws.service.AbstractUWS
choosenSerializer, defaultSerializer, description, executedAction, homePage, homeRedirection, mapJobLists, name, reInitUrlInterpreter, serializers, urlInterpreter, userIdentifier, uwsActions
 
Constructor Summary
QueuedBasicUWS(java.lang.Class<J> cl, int nbMaxRunningJobs)
          Builds a QueuedBasicUWS.
QueuedBasicUWS(java.lang.Class<J> cl, int nbMaxRunningJobs, java.lang.String baseURI)
          Builds a QueuedBasicUWS.
QueuedBasicUWS(java.lang.Class<J> cl, int nbMaxRunningJobs, UWSUrl urlInterpreter)
          Builds a QueuedBasicUWS.
 
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.BasicUWS
createJob, getConstructor
 
Methods inherited from class uws.service.AbstractUWS
addJobList, addSerializer, addUWSAction, addUWSAction, destroyAllJobLists, destroyJobList, 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, 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

QueuedBasicUWS

public QueuedBasicUWS(java.lang.Class<J> cl,
                      int nbMaxRunningJobs)
               throws UWSException
Builds a QueuedBasicUWS.

Parameters:
cl - The class object of the type of job to manage.
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(Class).
  • If the given class is abstract.
  • If the constructor with one parameter of type Map< String, String > doesn't exist for the given class object.
  • If any other error occurs during the fetching of the good constructor.
  • If the given maximum number of running jobs is negative or null.
See Also:
BasicUWS.BasicUWS(Class), QueuedExecutionManager.QueuedExecutionManager(int), AbstractUWS.setExecutionManager(uws.job.manager.ExecutionManager)

QueuedBasicUWS

public QueuedBasicUWS(java.lang.Class<J> cl,
                      int nbMaxRunningJobs,
                      java.lang.String baseURI)
               throws UWSException
Builds a QueuedBasicUWS.

Parameters:
cl - The class object of the type of job to manage.
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(Class, String).
  • If the given class is abstract.
  • If the constructor with one parameter of type Map< String, String > doesn't exist for the given class object.
  • If any other error occurs during the fetching of the good constructor.
  • If the given maximum number of running jobs is negative or null.
See Also:
BasicUWS.BasicUWS(Class, String), QueuedExecutionManager.QueuedExecutionManager(int), AbstractUWS.setExecutionManager(uws.job.manager.ExecutionManager)

QueuedBasicUWS

public QueuedBasicUWS(java.lang.Class<J> cl,
                      int nbMaxRunningJobs,
                      UWSUrl urlInterpreter)
               throws UWSException
Builds a QueuedBasicUWS.

Parameters:
cl - The class object of the type of job to manage.
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 to use in this UWS.
Throws:
UWSException -
  • If there is an error when calling the constructor super(Class, UWSUrl).
  • If the given class is abstract.
  • If the constructor with one parameter of type Map< String, String > doesn't exist for the given class object.
  • If any other error occurs during the fetching of the good constructor.
  • If the given maximum number of running jobs is negative or null.
See Also:
BasicUWS.BasicUWS(Class, 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)