Packages

c

com.twitter.finagle.service

SimpleRetryPolicy

abstract class SimpleRetryPolicy[A] extends RetryPolicy[A] with (A) => Option[(Duration, RetryPolicy[A])]

A retry policy abstract class. This is convenient to use for Java programmers. Simply implement the two abstract methods shouldRetry and backoffAt and you're good to go!

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SimpleRetryPolicy
  2. RetryPolicy
  3. Function1
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new SimpleRetryPolicy()
  2. new SimpleRetryPolicy(i: Int)

Abstract Value Members

  1. abstract def backoffAt(retry: Int): Duration

    Given a number of retries, return how long to wait till the next retry.

    Given a number of retries, return how long to wait till the next retry. Note that this is zero-indexed. To implement a finite number of retries, implement a method like: if (i > 3) return never

  2. abstract def shouldRetry(a: A): Boolean

    Given a value, decide whether it is retryable.

    Given a value, decide whether it is retryable. Typically the value is an exception.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def andThen[B](that: (Option[(Duration, RetryPolicy[A])]) => B): (A) => B
    Definition Classes
    SimpleRetryPolicy → Function1
  5. final def apply(e: A): Option[(Duration, RetryPolicy[A])]
    Definition Classes
    SimpleRetryPolicy → Function1
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. def compose[B](that: (B) => A): (B) => Option[(Duration, RetryPolicy[A])]
    Definition Classes
    SimpleRetryPolicy → Function1
  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def filter[B <: A](pred: (B) => Boolean): RetryPolicy[B]

    Creates a new RetryPolicy based on the current RetryPolicy in which values of A are first checked against a predicate function, and only if the predicate returns true will the value be passed on to the current RetryPolicy.

    Creates a new RetryPolicy based on the current RetryPolicy in which values of A are first checked against a predicate function, and only if the predicate returns true will the value be passed on to the current RetryPolicy.

    The predicate function need not be a pure function, but can change its behavior over time. For example, the predicate function's decision can be based upon backpressure signals supplied by things like failure rates or latency, which allows RetryPolicys to dynamically reduce the number of retries in response to backpressure.

    The predicate function is only called on the first failure in a chain. Any additional chained RetryPolicies returned by the current policy will then see additional failures unfiltered. Contrast this will filterEach, which applies the filter to each RetryPolicy in the chain.

    Definition Classes
    RetryPolicy
  12. def filterEach[B <: A](pred: (B) => Boolean): RetryPolicy[B]

    Similar to filter, but the predicate is applied to each RetryPolicy in the chain returned by the current RetryPolicy.

    Similar to filter, but the predicate is applied to each RetryPolicy in the chain returned by the current RetryPolicy. For example, if the current RetryPolicy returns Some((D, P')) for value E (of type A), and the given predicate returns true for E, then the value returned from the filtering RetryPolicy will be Some((D, P)) where P is equal to P'.filterEach(pred).

    One example where this is useful is to dynamically and fractionally allow retries based upon backpressure signals. If, for example, the predicate function returned true or false based upon a probability distribution computed from a backpressure signal, it could return true 50% of the time, giving you a 50% chance of performing a single retry, a 25% chance of performing 2 retries, 12.5% chance of performing 3 retries, etc. This might be more desirable than just using filter where you end up with a 50% chance of no retries and 50% chance of the full number of retries.

    Definition Classes
    RetryPolicy
  13. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  17. def limit(maxRetries: => Int): RetryPolicy[A]

    Applies a dynamically chosen retry limit to an existing RetryPolicy that may allow for more retries.

    Applies a dynamically chosen retry limit to an existing RetryPolicy that may allow for more retries. When the returned RetryPolicy is first invoked, it will call the maxRetries by-name parameter to get the current maximum retries allowed. Regardless of the number of retries that the underlying policy would allow, it is capped to be no greater than the number returned by maxRetries on the first failure in the chain.

    Using a dynamically chosen retry limit allows for the retry count to be tuned at runtime based upon backpressure signals such as failure rate or request latency.

    Definition Classes
    RetryPolicy
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final val never: Duration

    A convenience method to access Duration.Top from Java.

    A convenience method to access Duration.Top from Java. This is a sentinel value that signals no-further-retries.

  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  22. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    RetryPolicy → Function1 → AnyRef → Any
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from RetryPolicy[A]

Inherited from (A) => Option[(Duration, RetryPolicy[A])]

Inherited from AnyRef

Inherited from Any

Ungrouped