@InterfaceStability.Experimental @InterfaceAudience.Public public class RetryBuilder extends Object
Builder for RetryWhenFunction
. Start with #retryOnce()
or #retryMax(int)
factory methods.
By default, without calling additional methods it will retry the specified number of times, with a constant delay (see Retry.DEFAULT_DELAY
) and on all errors.
Modifier and Type | Class and Description |
---|---|
protected static class |
RetryBuilder.ShouldStopOnError |
Modifier and Type | Method and Description |
---|---|
static RetryBuilder |
allBut(Class<? extends Throwable>... types)
Only errors that are NOT instanceOf the specified types will trigger a retry
|
static RetryBuilder |
any()
Any error will trigger a retry
|
static RetryBuilder |
anyOf(Class<? extends Throwable>... types)
Only errors that are instanceOf the specified types will trigger a retry
|
RetryWhenFunction |
build()
Construct the resulting
RetryWhenFunction |
RetryBuilder |
delay(com.couchbase.client.core.time.Delay delay)
Customize the retry
Delay |
RetryBuilder |
delay(com.couchbase.client.core.time.Delay delay,
Scheduler scheduler)
Set both the
Delay and the Scheduler on which the delay is waited. |
RetryBuilder |
delay(Scheduler scheduler)
Use
Retry.DEFAULT_DELAY but wait on a specific Scheduler |
RetryBuilder |
max(int maxAttempts)
Make at most maxAttempts retry attempts
|
RetryBuilder |
once()
Make only one retry attempt (default)
|
public static RetryBuilder anyOf(Class<? extends Throwable>... types)
Only errors that are instanceOf the specified types will trigger a retry
public static RetryBuilder allBut(Class<? extends Throwable>... types)
Only errors that are NOT instanceOf the specified types will trigger a retry
public static RetryBuilder any()
Any error will trigger a retry
public RetryBuilder once()
Make only one retry attempt (default)
public RetryBuilder max(int maxAttempts)
Make at most maxAttempts retry attempts
public RetryBuilder delay(com.couchbase.client.core.time.Delay delay)
Customize the retry Delay
public RetryBuilder delay(Scheduler scheduler)
Use Retry.DEFAULT_DELAY
but wait on a specific Scheduler
public RetryBuilder delay(com.couchbase.client.core.time.Delay delay, Scheduler scheduler)
Set both the Delay
and the Scheduler
on which the delay is waited. If the delay is null, Retry.DEFAULT_DELAY
is used.
public RetryWhenFunction build()
Construct the resulting RetryWhenFunction
Copyright © 2014 Couchbase, Inc.