public final class TraditionalWorkQueue extends WorkQueue<TraditionalWorkQueueCfg> implements ConfigurationChangeListener<TraditionalWorkQueueCfg>
Constructor and Description |
---|
TraditionalWorkQueue()
Creates a new instance of this work queue.
|
Modifier and Type | Method and 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)
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.
|
waitUntilIdle
public TraditionalWorkQueue()
public void initializeWorkQueue(TraditionalWorkQueueCfg configuration)
WorkQueue
initializeWorkQueue
in class WorkQueue<TraditionalWorkQueueCfg>
configuration
- The configuration to use to initialize the work queue.public void finalizeWorkQueue(LocalizableMessage reason)
WorkQueue
finalizeWorkQueue
in class WorkQueue<TraditionalWorkQueueCfg>
reason
- The human-readable reason that the work queue is being shut down.public void submitOperation(Operation operation) throws LdapException
submitOperation
in class WorkQueue<TraditionalWorkQueueCfg>
operation
- The operation to be processed.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).public boolean trySubmitOperation(Operation operation) throws LdapException
WorkQueue
trySubmitOperation
in class WorkQueue<TraditionalWorkQueueCfg>
operation
- The operation to be processed.LdapException
- If the provided operation is not accepted for some reason (e.g., if the server is shutting down).public boolean isConfigurationChangeAcceptable(TraditionalWorkQueueCfg configuration, List<LocalizableMessage> unacceptableReasons)
ConfigurationChangeListener
isConfigurationChangeAcceptable
in interface ConfigurationChangeListener<TraditionalWorkQueueCfg>
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.true
if the proposed change is acceptable,
or false
if it is not.public ConfigChangeResult applyConfigurationChange(TraditionalWorkQueueCfg configuration)
ConfigurationChangeListener
applyConfigurationChange
in interface ConfigurationChangeListener<TraditionalWorkQueueCfg>
configuration
- The new configuration containing the changes.public boolean isIdle()
WorkQueue
isIdle
in class WorkQueue<TraditionalWorkQueueCfg>
true
if the work queue is currently idle, or false
if it is being used to process one or
more operations.public int getNumWorkerThreads()
getNumWorkerThreads
in class WorkQueue<TraditionalWorkQueueCfg>
Copyright 2010-2022 ForgeRock AS.