public class ParallelWorkQueue extends WorkQueue<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg> implements org.forgerock.opendj.config.server.ConfigurationChangeListener<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
Constructor and Description |
---|
ParallelWorkQueue()
Creates a new instance of this work queue.
|
Modifier and Type | Method and Description |
---|---|
org.forgerock.opendj.config.server.ConfigChangeResult |
applyConfigurationChange(org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg configuration) |
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 |
getOpsSubmitted()
Retrieves the total number of operations that have been successfully
submitted to this work queue for processing since server startup.
|
void |
initializeWorkQueue(org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg configuration)
Initializes this work queue based on the information in the
provided configuration entry.
|
boolean |
isConfigurationChangeAcceptable(org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg configuration,
List<LocalizableMessage> unacceptableReasons) |
boolean |
isIdle()
Indicates whether the work queue is currently processing any
requests.
|
Operation |
nextOperation(ParallelWorkerThread workerThread)
Retrieves the next operation that should be processed by one of the worker
threads, blocking if necessary until a new request arrives.
|
boolean |
removeOperation(Operation operation)
Attempts to remove the specified operation from this queue if it has not
yet been picked up for processing by one of the worker threads.
|
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 ParallelWorkQueue()
initializeWorkQueue
method.public void initializeWorkQueue(org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg configuration) throws org.forgerock.opendj.config.server.ConfigException, InitializationException
WorkQueue
initializeWorkQueue
in class WorkQueue<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
configuration
- The configuration to use to initialize
the work queue.org.forgerock.opendj.config.server.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<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
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<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
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<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
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(ParallelWorkerThread 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 boolean removeOperation(Operation operation)
operation
- The operation to remove from the queue.true
if the provided request was present in the queue
and was removed successfully, or false
it not.public long getOpsSubmitted()
public int size()
public boolean isConfigurationChangeAcceptable(org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg configuration, List<LocalizableMessage> unacceptableReasons)
isConfigurationChangeAcceptable
in interface org.forgerock.opendj.config.server.ConfigurationChangeListener<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
public org.forgerock.opendj.config.server.ConfigChangeResult applyConfigurationChange(org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg configuration)
applyConfigurationChange
in interface org.forgerock.opendj.config.server.ConfigurationChangeListener<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
public boolean isIdle()
WorkQueue
public int getNumWorkerThreads()
getNumWorkerThreads
in class WorkQueue<org.forgerock.opendj.server.config.server.ParallelWorkQueueCfg>
Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.