Package io.grpc.internal
Class ExponentialBackoffPolicy
java.lang.Object
io.grpc.internal.ExponentialBackoffPolicy
- All Implemented Interfaces:
BackoffPolicy
Retry Policy for Transport reconnection. Initial parameters from
https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
TODO(carl-mastrangelo): add unit tests for this class
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
private double
private long
private double
private long
private Random
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the number of nanoseconds to wait.(package private) ExponentialBackoffPolicy
setInitialBackoffNanos
(long initialBackoffNanos) (package private) ExponentialBackoffPolicy
setJitter
(double jitter) (package private) ExponentialBackoffPolicy
setMaxBackoffNanos
(long maxBackoffNanos) (package private) ExponentialBackoffPolicy
setMultiplier
(double multiplier) (package private) ExponentialBackoffPolicy
private long
uniformRandom
(double low, double high)
-
Field Details
-
random
-
initialBackoffNanos
private long initialBackoffNanos -
maxBackoffNanos
private long maxBackoffNanos -
multiplier
private double multiplier -
jitter
private double jitter -
nextBackoffNanos
private long nextBackoffNanos
-
-
Constructor Details
-
ExponentialBackoffPolicy
public ExponentialBackoffPolicy()
-
-
Method Details
-
nextBackoffNanos
public long nextBackoffNanos()Description copied from interface:BackoffPolicy
Returns the number of nanoseconds to wait.- Specified by:
nextBackoffNanos
in interfaceBackoffPolicy
-
uniformRandom
private long uniformRandom(double low, double high) -
setRandom
-
setInitialBackoffNanos
-
setMaxBackoffNanos
-
setMultiplier
-
setJitter
-