Package com.couchbase.client.core.retry
Class BestEffortRetryStrategy
- java.lang.Object
-
- com.couchbase.client.core.retry.BestEffortRetryStrategy
-
- All Implemented Interfaces:
RetryStrategy
public class BestEffortRetryStrategy extends Object implements RetryStrategy
ARetryStrategy
that will retry until the max request lifetime is reached.- Since:
- 1.1.0
- Author:
- Michael Nitschinger
-
-
Field Summary
Fields Modifier and Type Field Description static BestEffortRetryStrategy
INSTANCE
A reusable instance of this strategy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldRetry(CouchbaseRequest request, CoreEnvironment env)
Decides whether the givenCouchbaseRequest
should be retried or cancelled.boolean
shouldRetryObserve()
Decides whetherObserveRequest
s should be retried or cancelled when an error happens.String
toString()
-
-
-
Field Detail
-
INSTANCE
public static final BestEffortRetryStrategy INSTANCE
A reusable instance of this strategy.
-
-
Method Detail
-
shouldRetry
public boolean shouldRetry(CouchbaseRequest request, CoreEnvironment env)
Description copied from interface:RetryStrategy
Decides whether the givenCouchbaseRequest
should be retried or cancelled.- Specified by:
shouldRetry
in interfaceRetryStrategy
- Parameters:
request
- the request in question.env
- the environment for more context.- Returns:
- true if it should be retried, false otherwise.
-
shouldRetryObserve
public boolean shouldRetryObserve()
Description copied from interface:RetryStrategy
Decides whetherObserveRequest
s should be retried or cancelled when an error happens. When false is returned, as soon as an error happens (for example one of the nodes that need to be reached does not have an active partition because of a node failure) the whole observe sequence is aborted. If retried, errors are swallowed and the observe cycle will start again.- Specified by:
shouldRetryObserve
in interfaceRetryStrategy
- Returns:
- true if it should be retried, false otherwise.
-
-