Package org.apache.bookkeeper.client
Class DefaultSpeculativeRequestExecutionPolicy
- java.lang.Object
-
- org.apache.bookkeeper.client.DefaultSpeculativeRequestExecutionPolicy
-
- All Implemented Interfaces:
SpeculativeRequestExecutionPolicy
public class DefaultSpeculativeRequestExecutionPolicy extends java.lang.Object implements SpeculativeRequestExecutionPolicy
A default implementation ofSpeculativeRequestExecutionPolicy
.The policy issues speculative requests in a backoff way. The time between two speculative requests are between
firstSpeculativeRequestTimeout
andmaxSpeculativeRequestTimeout
.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) float
backoffMultiplier
(package private) int
firstSpeculativeRequestTimeout
(package private) int
maxSpeculativeRequestTimeout
-
Constructor Summary
Constructors Constructor Description DefaultSpeculativeRequestExecutionPolicy(int firstSpeculativeRequestTimeout, int maxSpeculativeRequestTimeout, float backoffMultiplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.ScheduledFuture<?>
initiateSpeculativeRequest(java.util.concurrent.ScheduledExecutorService scheduler, SpeculativeRequestExecutor requestExecutor)
Initialize the speculative request execution policy.
-
-
-
Method Detail
-
initiateSpeculativeRequest
public java.util.concurrent.ScheduledFuture<?> initiateSpeculativeRequest(java.util.concurrent.ScheduledExecutorService scheduler, SpeculativeRequestExecutor requestExecutor)
Initialize the speculative request execution policy.- Specified by:
initiateSpeculativeRequest
in interfaceSpeculativeRequestExecutionPolicy
- Parameters:
scheduler
- The scheduler service to issue the speculative requestrequestExecutor
- The executor is used to issue the actual speculative requests- Returns:
- ScheduledFuture, in case caller needs to cancel it.
-
-