Class RetryDelayStrategy

java.lang.Object
com.launchdarkly.eventsource.RetryDelayStrategy
Direct Known Subclasses:
DefaultRetryDelayStrategy

public abstract class RetryDelayStrategy extends Object
RetryDelayStrategy is an abstraction of how EventSource should determine the delay between retry attempts when a stream fails.

The default behavior, provided by DefaultRetryDelayStrategy, provides customizable exponential backoff and jitter. Applications may also create their own implementations of RetryDelayStrategy if they desire different behavior. It is generally a best practice to use backoff and jitter, to avoid a reconnect storm during a service interruption.

Implementations of this interface should be immutable. To implement strategies where the delay uses different parameters on each subsequent retry (such as exponential backoff), the strategy should return a new instance of its own class in RetryDelayStrategy.Result.getNext(), rather than modifying the state of the existing instance. This makes it easy for EventSource to reset to the original delay state when appropriate by simply reusing the original instance.

Since:
4.0.0