Class ServerQueueFactory<OBJ extends ServerQueue<T,QS>,T,QS extends QueueServer>

All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
AbstrPrioritySQFactory, LinearServerQFactory

public abstract class ServerQueueFactory<OBJ extends ServerQueue<T,QS>,T,QS extends QueueServer> extends DefaultSimObjectFactory<OBJ>
Abstract factory for server queues. This class is the base class for factories that create subclasses of ServerQueue.

A server queue contains a task queue, but the 'release' mechanism is not enabled by default, so only a subset of the parameters used to configure task queues are provided. In addition, the queue servers need to be specified. As a result, the parameters that this factory provides are the following:

  • "queueServer" - an instance of the subtype QS of QueueServer. For this case, one must use the "add" method instead of the "set" method as the entry will be added to a set of queue servers.
  • "deletePolicy" - an enumeration QueueDeletePolicy describing the 'delete' policy for the queue. The delete policy determines what happens when the caller deletes a queue whose length is nonzero. The values are as follows:
    • MUST_BE_EMPTY - the queue must be empty and not processing any more elements before it can be deleted.
    • WHEN_EMPTY - the queue will not accept new entries after the delete() method is called, with the actual deletion postponed until the queue is empty.
    • NEVER - the queue may not be deleted.
    The default is WHEN_EMPTY.

In addition, a server queue inherits the parameters timeline, timeline.time, timeline.traceSetMode, timeline.traceSets, and traceSets provided by SimObjectFactory.

Subclasses that are not abstract classes must implement the method getQueueServerClass. Unless the parameter "queueServer" is hidden and thus not used, subclasses will typically use the method getQueueServers() to obtain an array of the queue servers that were configured. This array is needed by the constructors of some subclasses.

See Also:
  • Constructor Details

    • ServerQueueFactory

      protected ServerQueueFactory(Simulation sim)
      Constructor.
      Parameters:
      sim - the simulation used to name objects.
  • Method Details

    • getQueueServerClass

      protected abstract Class<QS> getQueueServerClass()
      Get the base class of the objects implementing the QueueServer interface for this factory.
      Returns:
      the base class
    • numberOfQueueServers

      protected int numberOfQueueServers()
      Get the number of queue servers that have been configured.
      Returns:
      the number of queue servers
    • getQueueServers

      protected QS[] getQueueServers()
      Get the queue servers.
      Returns:
      an array of queue servers
    • clear

      public void clear()
      Description copied from class: NamedObjectFactory
      Clear all entries and restore to default values. Note: each subclass that implements this method should call super.clear(). Any subclass that defines parameters should call this method in order to restore the parameters to their default values. When an annotation processor is used for some parameters, those parameters can be restored to their default value by calling the parm manager's setDefaults method with the factory as its argument.
      Overrides:
      clear in class SimObjectFactory<DefaultSimObjectFactory<OBJ extends ServerQueue<T,QS>>,Simulation,OBJ extends ServerQueue<T,QS>>
    • initObject

      protected void initObject(OBJ object)
      Description copied from class: NamedObjectFactory
      Initialize an object. This method will call the methods for the object necessary to initialize it based on how the factory was configured, and is called by createObject() and createObjects unless these methods are overridden. The default method does nothing. Subclasses that override this method to provide subclass-specific initializations must start with the statement "super.initObject(object);".
      Overrides:
      initObject in class SimObjectFactory<DefaultSimObjectFactory<OBJ extends ServerQueue<T,QS>>,Simulation,OBJ extends ServerQueue<T,QS>>
      Parameters:
      object - the object to initialize