Class BoundedWorkQueueStrategy

  • All Implemented Interfaces:
    QueueingStrategy

    public class BoundedWorkQueueStrategy
    extends Object
    implements QueueingStrategy
    A QueueingStrategy that concurrently enqueues a bounded number of operations to the DirectoryServer work queue. If the maximum number of concurrently enqueued operations has been reached or if the work queue if full, then the operation will be executed on the current thread.
    • Constructor Detail

      • BoundedWorkQueueStrategy

        public BoundedWorkQueueStrategy​(Integer maxNbConcurrentOperations)
        Constructor for BoundedWorkQueueStrategy.
        Parameters:
        maxNbConcurrentOperations - the maximum number of operations that can be concurrently enqueued to the DirectoryServer work queue
    • Method Detail

      • getNumWorkerThreads

        protected int getNumWorkerThreads()
        Return the maximum number of worker threads that can be used by the WorkQueue (The WorkQueue could have a thread pool which adjusts its size).
        Returns:
        the maximum number of worker threads that can be used by the WorkQueue
      • tryEnqueueRequest

        protected boolean tryEnqueueRequest​(Operation op)
                                     throws DirectoryException
        Tries to add the provided operation to the work queue if not full so that it will be processed by one of the worker threads.
        Parameters:
        op - The operation to be added to the work queue.
        Returns:
        true if the operation could be enqueued, false otherwise
        Throws:
        DirectoryException - If a problem prevents the operation from being added to the queue (e.g., the queue is full).