public class ClusterExecutorImpl extends Object implements ClusterExecutor
| Constructor and Description |
|---|
ClusterExecutorImpl(Predicate<? super Address> predicate,
EmbeddedCacheManager manager,
JGroupsTransport transport,
long time,
TimeUnit unit,
Executor localExecutor) |
| Modifier and Type | Method and Description |
|---|---|
void |
execute(Runnable runnable) |
void |
execute(SerializableRunnable runnable)
The same as
Executor.execute(Runnable), except the Runnable must also implement Serializable. |
ClusterExecutor |
filterTargets(Collection<Address> addresses)
Allows for filtering of address nodes by only allowing addresses in this collection from being contacted.
|
ClusterExecutor |
filterTargets(Predicate<? super Address> predicate)
Allows for filtering of address nodes dynamically per invocation.
|
ClusterExecutor |
noFilter()
Applies no filtering and will send any invocations to all current nodes.
|
CompletableFuture<Void> |
submit(Runnable command)
Submits the runnable to the desired nodes and returns a CompletableFuture that will be completed when
all desired nodes complete the given command
|
CompletableFuture<Void> |
submit(SerializableRunnable runnable)
The same as
ClusterExecutor.submit(Runnable), except the Runnable must also implement Serializable. |
<V> CompletableFuture<Void> |
submitConsumer(Function<? super EmbeddedCacheManager,? extends V> function,
TriConsumer<? super Address,? super V,? super Throwable> triConsumer)
Submits the given command to the desired nodes and allows for handling of results as they return.
|
<V> CompletableFuture<Void> |
submitConsumer(SerializableFunction<? super EmbeddedCacheManager,? extends V> function,
TriConsumer<? super Address,? super V,? super Throwable> triConsumer)
The same as
ClusterExecutor.submitConsumer(Function, TriConsumer), except the Callable must also implement
Serializable. |
ClusterExecutor |
timeout(long time,
TimeUnit unit)
The timeout parameter is not adhered to when executing the command locally and is only for remote nodes.
|
public ClusterExecutorImpl(Predicate<? super Address> predicate, EmbeddedCacheManager manager, JGroupsTransport transport, long time, TimeUnit unit, Executor localExecutor)
public void execute(Runnable runnable)
ClusterExecutorThis command will be ran in the desired nodes, but no result is returned to notify the user of completion or failure.
execute in interface Executorexecute in interface ClusterExecutorrunnable - the command to executepublic void execute(SerializableRunnable runnable)
ClusterExecutorExecutor.execute(Runnable), except the Runnable must also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
execute in interface ClusterExecutorrunnable - the command to executepublic CompletableFuture<Void> submit(Runnable command)
ClusterExecutorIf a node encounters an exception, the first one to respond with such an exception will set the responding future to an exceptional state passing the given exception.
submit in interface ClusterExecutorcommand - the command to execute.public CompletableFuture<Void> submit(SerializableRunnable runnable)
ClusterExecutorClusterExecutor.submit(Runnable), except the Runnable must also implement Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
submit in interface ClusterExecutorrunnable - the command to executepublic <V> CompletableFuture<Void> submitConsumer(Function<? super EmbeddedCacheManager,? extends V> function, TriConsumer<? super Address,? super V,? super Throwable> triConsumer)
ClusterExecutorTriConsumer which will be called back each time for each desired node. Note that these callbacks
can be called from different threads at the same time. A completable future is returned to the caller used
for the sole purpose of being completed when all nodes have sent responses back.
Note the TriConsumer is only ran on the node where the task was submitted and thus doesn't need to be
serialized.
submitConsumer in interface ClusterExecutorV - the type of the task's resultfunction - the task to executetriConsumer - the tri-consumer to be called back upon for each node's resultpublic <V> CompletableFuture<Void> submitConsumer(SerializableFunction<? super EmbeddedCacheManager,? extends V> function, TriConsumer<? super Address,? super V,? super Throwable> triConsumer)
ClusterExecutorClusterExecutor.submitConsumer(Function, TriConsumer), except the Callable must also implement
Serializable.
This method will be used automatically by lambdas, which prevents users from having to manually cast to a Serializable lambda.
submitConsumer in interface ClusterExecutorV - the type of the task's resultfunction - the task to executetriConsumer - the tri-consumer to be called back upon for each node's resultpublic ClusterExecutor timeout(long time, TimeUnit unit)
ClusterExecutorThe timeout parameter is not adhered to when executing the command locally and is only for remote nodes.
timeout in interface ClusterExecutorpublic ClusterExecutor filterTargets(Predicate<? super Address> predicate)
ClusterExecutorClusterExecutor.filterTargets(Collection)).filterTargets in interface ClusterExecutorpredicate - the dynamic predicate applied each time an invocation is donepublic ClusterExecutor filterTargets(Collection<Address> addresses)
ClusterExecutorClusterExecutor.filterTargets(Predicate).filterTargets in interface ClusterExecutoraddresses - which nodes the executor invocations should go topublic ClusterExecutor noFilter()
ClusterExecutornoFilter in interface ClusterExecutorCopyright © 2024 JBoss, a division of Red Hat. All rights reserved.