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
-
Method Summary
Modifier and TypeMethodDescriptionUsed byCompletableFuture.thenComposeAsync(Function, Executor)
, it adds theExponentialBackOff
delay.void
void
void
run()
Executes, in a new thread, or queues the task.void
setBackOff
(ExponentialBackOff backOff) void
setExecutor
(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 theExponentialBackOff
delay.- Specified by:
apply
in interfaceFunction<Void,
CompletionStage<Void>> - Parameters:
unused
- Unused value.- Returns:
- The
CompletionStage
fromExponentialBackOff.asyncBackOff()
.
-