Package org.opends.server.extensions
Class TraditionalWorkQueue
- java.lang.Object
-
- org.opends.server.api.WorkQueue<TraditionalWorkQueueCfg>
-
- org.opends.server.extensions.TraditionalWorkQueue
-
- All Implemented Interfaces:
ConfigurationChangeListener<TraditionalWorkQueueCfg>
public final class TraditionalWorkQueue extends WorkQueue<TraditionalWorkQueueCfg> implements ConfigurationChangeListener<TraditionalWorkQueueCfg>
This class defines a data structure for storing and interacting with the Directory Server work queue.
-
-
Constructor Summary
Constructors Constructor Description TraditionalWorkQueue()
Creates a new instance of this work queue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(TraditionalWorkQueueCfg configuration)
Applies the configuration changes to this change listener.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.int
getNumWorkerThreads()
Return the number of worker threads used by this WorkQueue.void
initializeWorkQueue(TraditionalWorkQueueCfg configuration, ServerContext serverContext)
Initializes this work queue based on the information in the provided configuration entry.boolean
isConfigurationChangeAcceptable(TraditionalWorkQueueCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.boolean
isIdle()
Indicates whether the work queue is currently processing any requests.void
submitOperation(Operation operation)
Submits an operation to be processed by one of the worker threads associated with this work queue.boolean
trySubmitOperation(Operation operation)
Tries to submit an operation to be processed in the server, without blocking.-
Methods inherited from class org.opends.server.api.WorkQueue
waitUntilIdle
-
-
-
-
Method Detail
-
initializeWorkQueue
public void initializeWorkQueue(TraditionalWorkQueueCfg configuration, ServerContext serverContext)
Description copied from class:WorkQueue
Initializes this work queue based on the information in the provided configuration entry.- Specified by:
initializeWorkQueue
in classWorkQueue<TraditionalWorkQueueCfg>
- Parameters:
configuration
- The configuration to use to initialize the work queue.serverContext
- The server context.
-
finalizeWorkQueue
public void finalizeWorkQueue(LocalizableMessage reason)
Description copied from class:WorkQueue
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.- Specified by:
finalizeWorkQueue
in classWorkQueue<TraditionalWorkQueueCfg>
- Parameters:
reason
- The human-readable reason that the work queue is being shut down.
-
submitOperation
public void submitOperation(Operation operation) throws LdapException
Submits an operation to be processed by one of the worker threads associated with this work queue.- Specified by:
submitOperation
in classWorkQueue<TraditionalWorkQueueCfg>
- Parameters:
operation
- The operation to be processed.- Throws:
LdapException
- If the provided operation is not accepted for some reason (e.g., if the server is shutting down or the pending operation queue is already at its maximum capacity).
-
trySubmitOperation
public boolean trySubmitOperation(Operation operation) throws LdapException
Description copied from class:WorkQueue
Tries to submit an operation to be processed in the server, without blocking.- Specified by:
trySubmitOperation
in classWorkQueue<TraditionalWorkQueueCfg>
- Parameters:
operation
- The operation to be processed.- Returns:
- true if the operation could be submitted to the queue, false if the queue was full
- Throws:
LdapException
- If the provided operation is not accepted for some reason (e.g., if the server is shutting down).
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(TraditionalWorkQueueCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<TraditionalWorkQueueCfg>
- Parameters:
configuration
- The new configuration containing the changes.unacceptableReasons
- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
true
if the proposed change is acceptable, orfalse
if it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(TraditionalWorkQueueCfg configuration)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<TraditionalWorkQueueCfg>
- Parameters:
configuration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
isIdle
public boolean isIdle()
Description copied from class:WorkQueue
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.- Specified by:
isIdle
in classWorkQueue<TraditionalWorkQueueCfg>
- Returns:
true
if the work queue is currently idle, orfalse
if it is being used to process one or more operations.
-
getNumWorkerThreads
public int getNumWorkerThreads()
Return the number of worker threads used by this WorkQueue.- Specified by:
getNumWorkerThreads
in classWorkQueue<TraditionalWorkQueueCfg>
- Returns:
- the number of worker threads used by this WorkQueue
-
-