Class WorkQueue<T extends WorkQueueCfg>

java.lang.Object
org.opends.server.api.WorkQueue<T>
Type Parameters:
T - The type of configuration handled by this work queue.
All Implemented Interfaces:
Executor
Direct Known Subclasses:
TraditionalWorkQueue

public abstract class WorkQueue<T extends WorkQueueCfg> extends Object implements Executor
This class defines the structure and methods that must be implemented by a Directory Server work queue. The work queue is the component of the server that accepts requests from connection handlers and ensures that they are properly processed. The manner in which the work queue is able to accomplish this may vary between implementations, but in general it is assumed that one or more worker threads will be associated with the queue and may be used to process requests in parallel.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    execute(Runnable command)
    Submits a request to be processed in the server.
    abstract void
    Performs any necessary finalization for this work queue, including ensuring that all active operations are interrupted or will be allowed to complete, and that all pending operations will be cancelled.
    abstract void
    initializeWorkQueue(T configuration, ServerContext serverContext)
    Initializes this work queue based on the information in the provided configuration entry.
    abstract boolean
    Indicates whether the work queue is currently processing any requests.
    boolean
    waitUntilIdle(long timeLimit)
    Waits for the work queue to become idle before returning.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • WorkQueue

      public WorkQueue()
  • Method Details

    • initializeWorkQueue

      public abstract void initializeWorkQueue(T configuration, ServerContext serverContext) throws InitializationException
      Initializes this work queue based on the information in the provided configuration entry.
      Parameters:
      configuration - The configuration to use to initialize the work queue.
      serverContext - The server context.
      Throws:
      InitializationException - If a problem occurs during initialization that is not related to the server configuration.
    • finalizeWorkQueue

      public abstract void finalizeWorkQueue(LocalizableMessage reason)
      Performs any necessary finalization for this work queue, including ensuring that all active operations are interrupted or will be allowed to complete, and that all pending operations will be cancelled.
      Parameters:
      reason - The human-readable reason that the work queue is being shut down.
    • execute

      public abstract void execute(Runnable command)
      Submits a request to be processed in the server.
      Specified by:
      execute in interface Executor
      Parameters:
      command - The request to be processed.
    • isIdle

      public abstract boolean isIdle()
      Indicates whether the work queue is currently processing any requests. Note that this is a point-in-time determination, and if any component of the server wishes to depend on a quiescent state then it should use some external mechanism to ensure that no other requests are submitted to the queue.
      Returns:
      true if the work queue is currently idle, or false if it is being used to process one or more operations.
    • waitUntilIdle

      public boolean waitUntilIdle(long timeLimit)
      Waits for the work queue to become idle before returning. Note that this is a point-in-time determination, and if any component of the server wishes to depend on a quiescent state then it should use some external mechanism to ensure that no other requests are submitted to the queue.
      Parameters:
      timeLimit - The maximum length of time in milliseconds that this method should wait for the queue to become idle before giving up. A time limit that is less than or equal to zero indicates that there should not be a time limit.
      Returns:
      true if the work queue is idle at the time that this method returns, or false if the wait time limit was reached before the server became idle.