T
- The type of configuration handled by this work queue.@PublicAPI(stability=VOLATILE, mayExtend=true, mayInvoke=true) public abstract class WorkQueue<T extends WorkQueueCfg> extends Object
Constructor and Description |
---|
WorkQueue() |
Modifier and Type | Method and Description |
---|---|
abstract 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.
|
abstract int |
getNumWorkerThreads()
Return the maximum number of worker threads that can be used by this WorkQueue (The WorkQueue could have a thread
pool which adjusts its size).
|
abstract void |
initializeWorkQueue(T configuration)
Initializes this work queue based on the information in the provided configuration entry.
|
abstract boolean |
isIdle()
Indicates whether the work queue is currently processing any requests.
|
abstract void |
submitOperation(Operation operation)
Submits an operation to be processed in the server.
|
abstract boolean |
trySubmitOperation(Operation operation)
Tries to submit an operation to be processed in the server, without blocking.
|
boolean |
waitUntilIdle(long timeLimit)
Waits for the work queue to become idle before returning.
|
public abstract void initializeWorkQueue(T configuration) throws ConfigException, InitializationException
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 abstract void finalizeWorkQueue(LocalizableMessage reason)
reason
- The human-readable reason that the work queue is being shut down.public abstract void submitOperation(Operation operation) throws LdapException
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
already has too many pending requests in the queue).public abstract boolean trySubmitOperation(Operation operation) throws LdapException
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 abstract boolean isIdle()
true
if the work queue is currently idle, or false
if it is being used to process one or
more operations.public abstract int getNumWorkerThreads()
public boolean waitUntilIdle(long timeLimit)
timeLimit
- The maximum length of time in milliseconds that this method should wait for the queue to become idle
before giving up. A time limit that is less than or equal to zero indicates that there should not be a
time limit.true
if the work queue is idle at the time that this method returns, or false
if the wait
time limit was reached before the server became idle.Copyright 2010-2022 ForgeRock AS.