Package org.opends.server.core
Class BoundedWorkQueueStrategy
- java.lang.Object
-
- org.opends.server.core.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 Summary
Constructors Constructor Description BoundedWorkQueueStrategy(Integer maxNbConcurrentOperations)Constructor for BoundedWorkQueueStrategy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidenqueueRequest(Operation operation)Put the request in the queue.protected intgetNumWorkerThreads()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).protected booleantryEnqueueRequest(Operation op)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.
-
-
-
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
-
enqueueRequest
public void enqueueRequest(Operation operation) throws DirectoryException
Description copied from interface:QueueingStrategyPut the request in the queue.- Specified by:
enqueueRequestin interfaceQueueingStrategy- Parameters:
operation- Operation to put in the queue.- Throws:
DirectoryException- If a problem occurs in the Directory Server.
-
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).
-
-