Package org.filestack.internal
Class RetryNetworkFunc<T>
java.lang.Object
org.filestack.internal.RetryNetworkFunc<T>
- Type Parameters:
T
- type of object to return
Abstract class to generalize retry logic of a network call.
-
Constructor Summary
ConstructorDescriptionRetryNetworkFunc
(int maxNetworkRetries, int maxServerRetries, int delayBase) Constructs an instance following the given settings. -
Method Summary
Modifier and TypeMethodDescriptioncall()
Start the request.int
int
void
onNetworkFail
(int retries) Called for network failures.void
onServerFail
(int retries) Called for server failures.
-
Constructor Details
-
RetryNetworkFunc
public RetryNetworkFunc(int maxNetworkRetries, int maxServerRetries, int delayBase) Constructs an instance following the given settings. The network call is made inwork()
. Overrideprocess(Response)
to customize parsing the response.- Parameters:
maxNetworkRetries
- times to retry after a network failuremaxServerRetries
- times to retry after an error response from the serverdelayBase
- base for exponential backoff, delay (seconds) == base ^ retryCount
-
-
Method Details