Package org.infinispan.xsite.irac
Class IracExecutor
java.lang.Object
org.infinispan.xsite.irac.IracExecutor
- All Implemented Interfaces:
Runnable,Function<Void,CompletionStage<Void>>
Executes the "IRAC" sending task in a single thread.
This executor makes sure no more than one task is running at the same time. Also, it avoids "queueing" multiple tasks by queuing at most one. This is possible because the task does the same thing: iterator over pending updates and send them to the remote site.
In addition, it iteracts with the ExponentialBackOff to add delays in case of network failures.
- Since:
- 12
- Author:
- Pedro Ruivo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUsed byCompletableFuture.thenComposeAsync(Function, Executor), it adds theExponentialBackOffdelay.voidvoidvoidrun()Executes, in a new thread, or queues the task.voidsetBackOff(ExponentialBackOff backOff) voidsetExecutor(Executor executor)
-
Constructor Details
-
IracExecutor
-
-
Method Details
-
setExecutor
-
setBackOff
-
run
public void run()Executes, in a new thread, or queues the task. -
enableBackOff
public void enableBackOff() -
disableBackOff
public void disableBackOff() -
apply
Used byCompletableFuture.thenComposeAsync(Function, Executor), it adds theExponentialBackOffdelay.- Specified by:
applyin interfaceFunction<Void,CompletionStage<Void>> - Parameters:
unused- Unused value.- Returns:
- The
CompletionStagefromExponentialBackOff.asyncBackOff().
-