Package io.grpc.internal
Class BackoffPolicyRetryScheduler
- java.lang.Object
-
- io.grpc.internal.BackoffPolicyRetryScheduler
-
- All Implemented Interfaces:
RetryScheduler
final class BackoffPolicyRetryScheduler extends java.lang.Object implements RetryScheduler
Schedules a retry operation according to aBackoffPolicy
. The retry is run within aSynchronizationContext
. At most one retry is scheduled at a time.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.logging.Logger
logger
private BackoffPolicy
policy
private BackoffPolicy.Provider
policyProvider
private java.util.concurrent.ScheduledExecutorService
scheduledExecutorService
private SynchronizationContext.ScheduledHandle
scheduledHandle
private SynchronizationContext
syncContext
-
Constructor Summary
Constructors Constructor Description BackoffPolicyRetryScheduler(BackoffPolicy.Provider policyProvider, java.util.concurrent.ScheduledExecutorService scheduledExecutorService, SynchronizationContext syncContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
reset()
Resets theBackoffPolicyRetryScheduler
and cancels any pending retry task.void
schedule(java.lang.Runnable retryOperation)
Schedules a future retry operation.
-
-
-
Field Detail
-
scheduledExecutorService
private final java.util.concurrent.ScheduledExecutorService scheduledExecutorService
-
syncContext
private final SynchronizationContext syncContext
-
policyProvider
private final BackoffPolicy.Provider policyProvider
-
policy
private BackoffPolicy policy
-
scheduledHandle
private SynchronizationContext.ScheduledHandle scheduledHandle
-
logger
private static final java.util.logging.Logger logger
-
-
Constructor Detail
-
BackoffPolicyRetryScheduler
BackoffPolicyRetryScheduler(BackoffPolicy.Provider policyProvider, java.util.concurrent.ScheduledExecutorService scheduledExecutorService, SynchronizationContext syncContext)
-
-
Method Detail
-
schedule
public void schedule(java.lang.Runnable retryOperation)
Schedules a future retry operation. Only allows one retry to be scheduled at any given time.- Specified by:
schedule
in interfaceRetryScheduler
-
reset
public void reset()
Resets theBackoffPolicyRetryScheduler
and cancels any pending retry task. The policy will be cleared thus also resetting any state associated with it (e.g. a backoff multiplier).- Specified by:
reset
in interfaceRetryScheduler
-
-