object RetryPolicy
- Alphabetic
- By Inheritance
- RetryPolicy
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val ChannelClosedExceptionsOnly: PartialFunction[Try[Nothing], Boolean]
Use ResponseClassifier.RetryOnChannelClosed for the ResponseClassifier equivalent.
- val Never: RetryPolicy[Try[Nothing]]
A RetryPolicy that never retries.
A RetryPolicy that never retries.
- See also
none for a more generally applicable version.
- val TimeoutAndWriteExceptionsOnly: PartialFunction[Try[Nothing], Boolean]
Use ResponseClassifier.RetryOnTimeout composed with ResponseClassifier.RetryOnWriteExceptions for the ResponseClassifier equivalent.
- val WriteExceptionsOnly: PartialFunction[Try[Nothing], Boolean]
Failures that are generally retryable because the request failed before it finished being written to the remote service.
Failures that are generally retryable because the request failed before it finished being written to the remote service. See com.twitter.finagle.WriteException.
- def apply[A](f: (A) => Option[(Duration, RetryPolicy[A])]): RetryPolicy[A]
Lifts a function of type
A => Option[(Duration, RetryPolicy[A])]
in theRetryPolicy
type.Lifts a function of type
A => Option[(Duration, RetryPolicy[A])]
in theRetryPolicy
type.- f
The function used to classify values.
- Note
the RetryPolicy.named function should be preferred to make inspection of the RetryPolicy easier.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def backoff[A](backoffs: Backoff)(shouldRetry: PartialFunction[A, Boolean]): RetryPolicy[A]
Retry based on a series of backoffs defined by a
Stream[Duration]
.Retry based on a series of backoffs defined by a
Stream[Duration]
. The stream is consulted to determine the duration after which a request is to be retried. APartialFunction
argument determines which request types are retryable.- See also
backoffJava for a Java friendly API.
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def combine[A](policies: RetryPolicy[A]*): RetryPolicy[A]
Combines multiple
RetryPolicy
s into a single combinedRetryPolicy
, with interleaved backoffs.Combines multiple
RetryPolicy
s into a single combinedRetryPolicy
, with interleaved backoffs. For a given value ofA
, each policy inpolicies
is tried in order. If all policies returnNone
, then the combinedRetryPolicy
returnsNone
. If policyP
returnsSome((D, P'))
, then the combinedRetryPolicy
returnsSome((D, P))
is a new combined, where
PRetryPolicy
with the same sub-policies, with the exception ofP
replaced byP'
.The ordering of policies matters: earlier policies get a chance to handle the failure before later policies; a catch-all policy, if any, should be last.
As an example, let's say you combine two
RetryPolicy
s,R1
andR2
, whereR1
handles only exceptionE1
with a backoff of(10.milliseconds, 20.milliseconds, 30.milliseconds)
, whileR2
handles only exceptionE2
with a backoff of(15.milliseconds, 25.milliseconds)
.If a sequence of exceptions,
(E2, E1, E1, E2)
, is fed in order to the combined retry policy, the backoffs seen will be(15.milliseconds, 10.milliseconds, 20.milliseconds, 25.milliseconds)
.The maximum number of retries the combined policy could allow under the worst case scenario of exceptions is equal to the sum of the individual maximum retries of each subpolicy. To put a cap on the combined maximum number of retries, you can call
limit
on the combined policy with a smaller cap. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def named[A](name: String)(f: (A) => Option[(Duration, RetryPolicy[A])]): RetryPolicy[A]
Lifts a function of type
A => Option[(Duration, RetryPolicy[A])]
in theRetryPolicy
type.Lifts a function of type
A => Option[(Duration, RetryPolicy[A])]
in theRetryPolicy
type.- name
The name to use in the
.toString
method which can aid in inspection.- f
The function used to classify values.
- def namedPF[A](name: String)(f: PartialFunction[A, Boolean]): PartialFunction[A, Boolean]
Create a
PartialFunction
with a defined.toString
method.Create a
PartialFunction
with a defined.toString
method.- name
the value to use for
toString
- f
the
PartialFunction
to apply the name to.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val none: RetryPolicy[Any]
A RetryPolicy that never retries.
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def tries(numTries: Int): RetryPolicy[Try[Nothing]]
Try up to a specific number of times of times on failures that are com.twitter.finagle.service.RetryPolicy.WriteExceptionsOnly.
Try up to a specific number of times of times on failures that are com.twitter.finagle.service.RetryPolicy.WriteExceptionsOnly.
The returned policy has jittered backoffs between retries.
- numTries
the maximum number of attempts (including retries) that can be made. A value of
1
means one attempt and no retries on failure. A value of2
means one attempt and then a single retry if the failure meets the criteria of com.twitter.finagle.service.RetryPolicy.WriteExceptionsOnly.
- def tries[A](numTries: Int, shouldRetry: PartialFunction[A, Boolean]): RetryPolicy[A]
Try up to a specific number of times, based on the supplied
PartialFunction[A, Boolean]
.Try up to a specific number of times, based on the supplied
PartialFunction[A, Boolean]
. A value of typeA
is considered retryable if and only if the PartialFunction is defined at and returns true for that value.The returned policy has jittered backoffs between retries.
- numTries
the maximum number of attempts (including retries) that can be made. A value of
1
means one attempt and no retries on failure. A value of2
means one attempt and then a single retry if the failure meets the criteria ofshouldRetry
.- shouldRetry
which
A
-typed values are considered retryable.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object RetryableWriteException
An extractor for exceptions which are known to be safe to retry.
An extractor for exceptions which are known to be safe to retry.
- See also
Deprecated Value Members
- def backoffJava[A](backoffs: Backoff, shouldRetry: PartialFunction[A, Boolean]): RetryPolicy[A]
- backoffs
can be created via Backoff.toJava.