public class ActionSequencer extends Object
It has the following properties:
Constructor and Description |
---|
ActionSequencer(Executor executor,
boolean forceExecutor,
TimeService timeService) |
Modifier and Type | Method and Description |
---|---|
long |
getAverageQueueTimeNanos() |
long |
getAverageRunningTimeNanos() |
int |
getMapSize() |
long |
getPendingActions() |
long |
getRunningActions() |
<T> CompletionStage<T> |
orderOnKey(Object key,
Callable<? extends CompletionStage<T>> action) |
<T> CompletionStage<T> |
orderOnKeys(Collection<?> keys,
Callable<? extends CompletionStage<T>> action)
It order a non-blocking action.
|
void |
resetStatistics() |
void |
setStatisticEnabled(boolean enable) |
public ActionSequencer(Executor executor, boolean forceExecutor, TimeService timeService)
executor
- Executor to run submitted actions.forceExecutor
- If false
, run submitted actions on the submitter thread if possible. If true
,
always run submitted actions on the executor.public <T> CompletionStage<T> orderOnKeys(Collection<?> keys, Callable<? extends CompletionStage<T>> action)
It assumes the action
does not block the invoked thread and it may execute it in this thread or, if there
is one or more pending actions, in a separate thread (provided by the executor
).
T
- The return value type.keys
- The ordering keys.action
- The Callable
to invoke.CompletableFuture
that is completed with the return value of resulting CompletableFuture
.NullPointerException
- if any of the parameter is null.public <T> CompletionStage<T> orderOnKey(Object key, Callable<? extends CompletionStage<T>> action)
public long getPendingActions()
public long getRunningActions()
public void resetStatistics()
public long getAverageQueueTimeNanos()
public long getAverageRunningTimeNanos()
public void setStatisticEnabled(boolean enable)
public int getMapSize()
Copyright © 2021 JBoss by Red Hat. All rights reserved.