sealed trait Retry[+T] extends AnyRef
The Retry type represents a computation that is retrying itself in case of an exception. It uses a RetryStrategy
as a policy for the retry operation.
The result may be successful consisting of the computation result value or a failure that is wrapping the underlying exception. The type is similar to the scala scala.util.Try type.
Example:
import scala.concurrent.duration._ import util.retry.blocking.{RetryStrategy, Failure, Retry, Success} implicit val retryStrategy = RetryStrategy.fixedBackOff(retryDuration = 1.seconds, maxAttempts = 2) val r = Retry(1 / 1) match { case Success(x) => x case Failure(t) => log("Exception occurred", t) }
- Alphabetic
- By Inheritance
- Retry
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
flatMap[S](f: (T) ⇒ Retry[S]): Retry[S]
Returns
trueif theRetryis aFailureotherwise it returnsfalse. -
abstract
def
foreach[X](f: (T) ⇒ X): Unit
Applies the given function
fif this is aSuccess, otherwise returnsUnitif this is aFailure. -
abstract
def
get: T
Returns the computation value in case of a
Success.Returns the computation value in case of a
Success. In case of aFailureit throws the underlying exception. -
abstract
def
isFailure: Boolean
Returns
trueif theRetryis aFailureotherwise it returnsfalse. -
abstract
def
isSuccess: Boolean
Returns
trueif theRetryis aSuccessotherwise it returnsfalseotherwise. -
abstract
def
map[S](f: (T) ⇒ S)(implicit strategy: RetryStrategyProducer): Retry[S]
Maps the given function to the value from this
Successor returns this if this is aFailure. -
abstract
def
recover[X >: T](f: PartialFunction[Throwable, X]): Retry[X]
Applies the given function
fif this is aFailure, otherwise returns this if this is aSuccess. -
abstract
def
transform[X](f: (T) ⇒ X): X
Transforms the
Retryvalue by applying a transformation function to its underlying value
Concrete 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
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getOrElse[U >: T](default: ⇒ U): U
Returns the computation value in case of a
Success.Returns the computation value in case of a
Success. Otherwise it is returning the provided default. -
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
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
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )