public 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.
|
long |
getOpsRejectedDueToQueueFull()
Retrieves the total number of operations that have been rejected because the work queue was already at its
maximum capacity.
|
long |
getOpsSubmitted()
Retrieves the total number of operations that have been successfully submitted to this work queue for processing
since server startup.
|
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.
|
Operation |
nextOperation(TraditionalWorkerThread workerThread)
Retrieves the next operation that should be processed by one of the worker threads, blocking if necessary until a
new request arrives.
|
boolean |
shutdownRequested()
Indicates whether this work queue has received a request to shut down.
|
int |
size()
Retrieves the number of pending operations in the queue that have not yet been picked up for processing.
|
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.
|
computeNumWorkerThreads, waitUntilIdle
public TraditionalWorkQueue()
initializeWorkQueue
method.public void initializeWorkQueue(TraditionalWorkQueueCfg configuration) throws ConfigException, InitializationException
WorkQueue
initializeWorkQueue
in class WorkQueue<TraditionalWorkQueueCfg>
configuration
- The configuration to use to initialize the work queue.ConfigException
- If the provided configuration entry does not have a valid work queue configuration.InitializationException
- If a problem occurs during initialization that is not related to the server configuration.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 boolean shutdownRequested()
true
if the work queue has recieved a request to shut down, or false
if not.public void submitOperation(Operation operation) throws DirectoryException
submitOperation
in class WorkQueue<TraditionalWorkQueueCfg>
operation
- The operation to be processed.DirectoryException
- 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 DirectoryException
WorkQueue
trySubmitOperation
in class WorkQueue<TraditionalWorkQueueCfg>
operation
- The operation to be processed.DirectoryException
- If the provided operation is not accepted for some reason (e.g., if the server is shutting down).public Operation nextOperation(TraditionalWorkerThread workerThread)
workerThread
- The worker thread that is requesting the operation.null
if the server is shutting down and no
more operations will be processed.public long getOpsSubmitted()
public long getOpsRejectedDueToQueueFull()
public int size()
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-2020 ForgeRock AS.