Package akka.pattern

Class CircuitBreaker$


  • public class CircuitBreaker$
    extends java.lang.Object
    Create a new CircuitBreaker.

    Callbacks run in caller's thread when using withSyncCircuitBreaker, and in same ExecutionContext as the passed in Future when using withCircuitBreaker. To use another ExecutionContext for the callbacks you can specify the executor in the constructor.

    param: scheduler Reference to Akka scheduler param: maxFailures Maximum number of failures before opening the circuit param: callTimeout FiniteDuration of time after which to consider a call a failure param: resetTimeout FiniteDuration of time after which to attempt to close the circuit

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static CircuitBreaker$ MODULE$
      Static reference to the singleton instance of this Scala object.
    • Constructor Summary

      Constructors 
      Constructor Description
      CircuitBreaker$()  
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      CircuitBreaker apply​(Scheduler scheduler, int maxFailures, scala.concurrent.duration.FiniteDuration callTimeout, scala.concurrent.duration.FiniteDuration resetTimeout)  
      protected <T> scala.Function1<scala.util.Try<T>,​java.lang.Object> convertJavaFailureFnToScala​(java.util.function.BiFunction<java.util.Optional<T>,​java.util.Optional<java.lang.Throwable>,​java.lang.Boolean> javaFn)  
      CircuitBreaker create​(Scheduler scheduler, int maxFailures, java.time.Duration callTimeout, java.time.Duration resetTimeout)
      Java API: Create a new CircuitBreaker.
      CircuitBreaker create​(Scheduler scheduler, int maxFailures, scala.concurrent.duration.FiniteDuration callTimeout, scala.concurrent.duration.FiniteDuration resetTimeout)
      Deprecated.
      Use the overloaded one which accepts java.time.Duration instead.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE$

        public static final CircuitBreaker$ MODULE$
        Static reference to the singleton instance of this Scala object.
    • Constructor Detail

      • CircuitBreaker$

        public CircuitBreaker$()
    • Method Detail

      • apply

        public CircuitBreaker apply​(Scheduler scheduler,
                                    int maxFailures,
                                    scala.concurrent.duration.FiniteDuration callTimeout,
                                    scala.concurrent.duration.FiniteDuration resetTimeout)
      • create

        public CircuitBreaker create​(Scheduler scheduler,
                                     int maxFailures,
                                     scala.concurrent.duration.FiniteDuration callTimeout,
                                     scala.concurrent.duration.FiniteDuration resetTimeout)
        Deprecated.
        Use the overloaded one which accepts java.time.Duration instead. Since 2.5.12.
        Java API: Create a new CircuitBreaker.

        Callbacks run in caller's thread when using withSyncCircuitBreaker, and in same ExecutionContext as the passed in Future when using withCircuitBreaker. To use another ExecutionContext for the callbacks you can specify the executor in the constructor.

        Parameters:
        scheduler - Reference to Akka scheduler
        maxFailures - Maximum number of failures before opening the circuit
        callTimeout - FiniteDuration of time after which to consider a call a failure
        resetTimeout - FiniteDuration of time after which to attempt to close the circuit
        Returns:
        (undocumented)
      • create

        public CircuitBreaker create​(Scheduler scheduler,
                                     int maxFailures,
                                     java.time.Duration callTimeout,
                                     java.time.Duration resetTimeout)
        Java API: Create a new CircuitBreaker.

        Callbacks run in caller's thread when using withSyncCircuitBreaker, and in same ExecutionContext as the passed in Future when using withCircuitBreaker. To use another ExecutionContext for the callbacks you can specify the executor in the constructor.

        Parameters:
        scheduler - Reference to Akka scheduler
        maxFailures - Maximum number of failures before opening the circuit
        callTimeout - Duration of time after which to consider a call a failure
        resetTimeout - Duration of time after which to attempt to close the circuit
        Returns:
        (undocumented)
      • convertJavaFailureFnToScala

        protected <T> scala.Function1<scala.util.Try<T>,​java.lang.Object> convertJavaFailureFnToScala​(java.util.function.BiFunction<java.util.Optional<T>,​java.util.Optional<java.lang.Throwable>,​java.lang.Boolean> javaFn)