@Singleton public class TaskDispatcher extends Object
TaskExecutor
implementation that will be used to dispatch tasks to
perform.TaskExecutor
,
Task
Constructor and Description |
---|
TaskDispatcher(TaskFactory taskFactory,
TaskExecutor taskExecutor)
Create a default instance of the TaskDispatcher.
|
Modifier and Type | Method and Description |
---|---|
void |
continuousQuery(ContinuousQueryListener listener,
TokenFilter tokenFilter)
Perform a continuous query against the persistent store and signal the results to the provided
ContinuousQueryListener . |
void |
create(Token token,
org.forgerock.util.Options options,
ResultHandler<Token,?> handler)
The CTS Token to create in the persistent store.
|
void |
delete(String tokenId,
org.forgerock.util.Options options,
ResultHandler<PartialToken,?> handler)
The Token ID, for a specific revision of the token, to delete from the persistent store.
|
void |
delete(String tokenId,
ResultHandler<PartialToken,?> handler)
The Token ID to delete from the persistent store.
|
void |
partialQuery(TokenFilter tokenFilter,
ResultHandler<Collection<PartialToken>,?> handler)
Perform a query against the persistent store and signal the results to the provided ResultHandler.
|
void |
query(TokenFilter tokenFilter,
ResultHandler<Collection<Token>,?> handler)
Perform a query against the persistent store and signal the results to the provided ResultHandler.
|
void |
read(String tokenId,
org.forgerock.util.Options options,
ResultHandler<Token,?> handler)
The CTS Token to read from the persistent store.
|
void |
removeContinuousQueryListener(ContinuousQueryListener listener,
TokenFilter tokenFilter)
Removes the supplied
ContinuousQueryListener from the query which is operating the
supplied TokenFilter . |
void |
startDispatcher()
Start the dispatcher.
|
void |
stopContinuousQuery(TokenFilter tokenFilter)
Stops a
ContinuousQuery having removed all its ContinuousQueryListener s. |
void |
update(Token token,
org.forgerock.util.Options options,
ResultHandler<Token,?> handler)
The CTS Token to update in the persistent store.
|
@Inject public TaskDispatcher(TaskFactory taskFactory, TaskExecutor taskExecutor)
taskFactory
- Required to create Task instances.taskExecutor
- Required for execution of the tasks.public void startDispatcher()
public void create(Token token, org.forgerock.util.Options options, ResultHandler<Token,?> handler) throws CoreTokenException
token
- Non null token to create.options
- Non null Options for the operation.handler
- Non null ResultHandler to notify.CoreTokenException
TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void read(String tokenId, org.forgerock.util.Options options, ResultHandler<Token,?> handler) throws CoreTokenException
tokenId
- Non null Token ID.options
- Non null Options for the operation.handler
- Non null ResultHandler to notify.CoreTokenException
- If there was a problem adding the task to the queue.ResultHandler
,
TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void update(Token token, org.forgerock.util.Options options, ResultHandler<Token,?> handler) throws CoreTokenException
token
- Non null Token.options
- Non null Options for the operation.handler
- Non null ResultHandler to notify.CoreTokenException
- If there was a problem adding the task to the queue.TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void delete(String tokenId, ResultHandler<PartialToken,?> handler) throws CoreTokenException
tokenId
- Non null Token ID.handler
- Non null ResultHandler to notify.CoreTokenException
- If there was an unexpected error during processing.IllegalArgumentException
- If tokenId was null.TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void delete(String tokenId, org.forgerock.util.Options options, ResultHandler<PartialToken,?> handler) throws CoreTokenException
tokenId
- Non null Token ID.options
- Non null Options for the operation.handler
- Non null ResultHandler to notify.CoreTokenException
- If there was an unexpected error during processing.IllegalArgumentException
- If tokenId was null.TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void query(TokenFilter tokenFilter, ResultHandler<Collection<Token>,?> handler) throws CoreTokenException
QueryTask
on. There is no guarantee that multiple query operations will be performed by the same
SeriesTaskExecutorThread
.tokenFilter
- Non null TokenFilter.handler
- Non null ResultHandler to notify.CoreTokenException
- If there was a problem adding the task to the queue.ResultHandler
,
TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void partialQuery(TokenFilter tokenFilter, ResultHandler<Collection<PartialToken>,?> handler) throws CoreTokenException
PartialQueryTask
on. There is no guarantee that multiple query operations will be performed by the same
SeriesTaskExecutorThread
.tokenFilter
- Non null TokenFilter.handler
- Non null ResultHandler to notify.CoreTokenException
- If there was a problem adding the task to the queue.ResultHandler
,
TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void continuousQuery(ContinuousQueryListener listener, TokenFilter tokenFilter) throws CoreTokenException
ContinuousQueryListener
.
If a ContinuousQuery
already exists for the provided TokenFilter
this method will simply add
the listener to that query.
Note: Because a continuous query has no associated Token ID, this function will select a random queue to place
the QueryTask
on. There is no guarantee that multiple continuous query operations will be performed by
the same SeriesTaskExecutorThread
.listener
- Non null ResultHandler to notify.tokenFilter
- Non null TokenFilter.CoreTokenException
- If there was a problem adding the task to the queue.ContinuousQueryListener
,
TaskDispatcher
,
CTSQueueConfiguration.getQueueTimeout()
public void removeContinuousQueryListener(ContinuousQueryListener listener, TokenFilter tokenFilter)
ContinuousQueryListener
from the query which is operating the
supplied TokenFilter
.
A continuous query that has no listeners will NOT be stopped, and may have further listeners added to it later.listener
- Non null ResultHandler to notify.tokenFilter
- Non null TokenFilter.ContinuousQueryListener
,
TaskDispatcher
public void stopContinuousQuery(TokenFilter tokenFilter)
ContinuousQuery
having removed all its ContinuousQueryListener
s. If no
query exists for the filter this method performs no action.tokenFilter
- Non null TokenFilter.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.