Package akka.pattern

Class CircuitBreaker$


  • public class CircuitBreaker$
    extends java.lang.Object
    Companion object providing factory methods for Circuit Breaker which runs callbacks in caller's thread
    • 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 
      Modifier and Type Method Description
      CircuitBreaker apply​(Scheduler scheduler, int maxFailures, scala.concurrent.duration.FiniteDuration callTimeout, scala.concurrent.duration.FiniteDuration resetTimeout)
      Create a new CircuitBreaker.
      CircuitBreaker apply​(java.lang.String id, ExtendedActorSystem system)
      Create or find a CircuitBreaker in registry.
      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 lookup​(java.lang.String id, ExtendedActorSystem system)
      Java API: Lookup a CircuitBreaker in registry.
      • 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 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
      • apply

        public CircuitBreaker apply​(java.lang.String id,
                                    ExtendedActorSystem system)
        Create or find a CircuitBreaker in registry.

        Parameters:
        id - Circuit Breaker identifier
        system - ExtendedActorSystem that is storing this CircuitBreaker
      • 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
      • lookup

        public CircuitBreaker lookup​(java.lang.String id,
                                     ExtendedActorSystem system)
        Java API: Lookup a CircuitBreaker in registry.

        Parameters:
        id - Circuit Breaker identifier
        system - ExtendedActorSystem that is storing this CircuitBreaker
      • 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)