vertx-lang-scala-docs_2.12 3.4.0 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package circuitbreaker
  Definition Classes
    scala
- CircuitBreaker
- CircuitBreakerOptions
- HystrixMetricHandler

c

io.vertx.scala.circuitbreaker

# CircuitBreaker 

###
Companion object CircuitBreaker

#### class CircuitBreaker extends AnyRef

An implementation of the circuit breaker pattern for Vert.x

Linear Supertypes
AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. CircuitBreaker
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new CircuitBreaker(_asJava: AnyRef)

### 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.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
6.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @throws( ... )
7.  def close(): CircuitBreaker

   Closes the circuit breaker.

   Closes the circuit breaker. It stops sending events on its state on the event bus. This method is not related to the `close` state of the circuit breaker. To set the circuit breaker in the `close` state, use io.vertx.scala.circuitbreaker.CircuitBreaker#reset.

8.  def closeHandler(handler: Handler[Unit]): CircuitBreaker

   Sets a invoked when the circuit breaker state switches to close.

   Sets a invoked when the circuit breaker state switches to close.

   handler

     the handler, must not be `null`

   returns

     the current CircuitBreaker

9.  final def eq(arg0: AnyRef): Boolean
   Definition Classes
     AnyRef
10.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
11.  def execute[T](command: Handler[Future[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback.

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback.

    command

      the operation

    returns

      a future object completed when the operation or its fallback completes

12.  def executeAndReport[T](resultFuture: Future[T], command: Handler[Future[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): CircuitBreaker

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeAndReportWithFallback but using the circuit breaker default fallback.

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeAndReportWithFallback but using the circuit breaker default fallback.

    resultFuture

      the future on which the operation result is reported

    command

      the operation

    returns

      the current CircuitBreaker

13.  def executeAndReportWithFallback[T](resultFuture: Future[T], command: Handler[Future[T]], fallback: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): CircuitBreaker

    Executes the given operation with the circuit breaker control.

    Executes the given operation with the circuit breaker control. The operation is generally calling an external system. The operation receives a object as parameter and must call when the operation has terminated successfully. The operation must also call in case of failure.

    The operation is not invoked if the circuit breaker is open, and the given fallback is called immediately. The circuit breaker also monitor the completion of the operation before a configure timeout. The operation is considered as failed if it does not terminate in time.

    Unlike io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback, this method does return a object, but let the caller pass a object on which the result is reported. If the fallback is called, the future is successfully completed with the value returned by the fallback function. If the fallback throws an exception, the future is marked as failed.

    resultFuture

      the future on which the operation result is reported

    command

      the operation

    fallback

      the fallback function. It gets an exception as parameter and returns the fallback result

    returns

      the current CircuitBreaker

14.  def executeCommand[T](command: Handler[Future[T]], handler: Handler[AsyncResult[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Unit

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback.

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using the circuit breaker default fallback.

    command

      the operation

15.  def executeCommandFuture[T](command: Handler[Future[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]

    Like executeCommand but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

16.  def executeCommandWithFallback[T](command: Handler[Future[T]], fallback: (Throwable) ⇒ T, handler: Handler[AsyncResult[T]])(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Unit

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using a callback.

    Same as io.vertx.scala.circuitbreaker.CircuitBreaker#executeWithFallback but using a callback.

    command

      the operation

    fallback

      the fallback

    handler

      the completion handler receiving either the operation result or the fallback result. The parameter is an io.vertx.lang.scala.AsyncResult because if the fallback is not called, the error is passed to the handler.

17.  def executeCommandWithFallbackFuture[T](command: Handler[Future[T]], fallback: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]

    Like executeCommandWithFallback but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

18.  def executeWithFallback[T](command: Handler[Future[T]], fallback: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Future[T]

    Executes the given operation with the circuit breaker control.

    Executes the given operation with the circuit breaker control. The operation is generally calling an external system. The operation receives a object as parameter and must call when the operation has terminated successfully. The operation must also call in case of failure.

    The operation is not invoked if the circuit breaker is open, and the given fallback is called immediately. The circuit breaker also monitor the completion of the operation before a configure timeout. The operation is considered as failed if it does not terminate in time.

    This method returns a object to retrieve the status and result of the operation, with the status being a success or a failure. If the fallback is called, the returned future is successfully completed with the value returned from the fallback. If the fallback throws an exception, the returned future is marked as failed.

    command

      the operation

    fallback

      the fallback function. It gets an exception as parameter and returns the fallback result

    returns

      a future object completed when the operation or its fallback completes

19.  def failureCount(): Long

    returns

      the current number of failures.

20.  def fallback[T](handler: (Throwable) ⇒ T)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): CircuitBreaker

    Sets a default invoked when the bridge is open to handle the "request", or on failure if CircuitBreakerOptions is enabled.

    Sets a default invoked when the bridge is open to handle the "request", or on failure if CircuitBreakerOptions is enabled.

    The function gets the exception as parameter and returns the fallback result.

    handler

      the handler

    returns

      the current CircuitBreaker

21.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
22.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
23.  def halfOpenHandler(handler: Handler[Unit]): CircuitBreaker

    Sets a invoked when the circuit breaker state switches to half-open.

    Sets a invoked when the circuit breaker state switches to half-open.

    handler

      the handler, must not be `null`

    returns

      the current CircuitBreaker

24.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
25.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
26.  def name(): String

    returns

      the name of the circuit breaker.

27.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
28.  final def notify(): Unit
    Definition Classes
      AnyRef
29.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
30.  def open(): CircuitBreaker

    Explicitly opens the circuit.

    Explicitly opens the circuit.

    returns

      the current CircuitBreaker

31.  def openHandler(handler: Handler[Unit]): CircuitBreaker

    Sets a invoked when the circuit breaker state switches to open.

    Sets a invoked when the circuit breaker state switches to open.

    handler

      the handler, must not be `null`

    returns

      the current CircuitBreaker

32.  def reset(): CircuitBreaker

    Resets the circuit breaker state (number of failure set to 0 and state set to closed).

    Resets the circuit breaker state (number of failure set to 0 and state set to closed).

    returns

      the current CircuitBreaker

33.  def state(): CircuitBreakerState

    returns

      the current state.

34.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
35.  def toString(): String
    Definition Classes
      AnyRef → Any
36.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
37.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
38.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )

### Inherited from AnyRef

### Inherited from Any

### Ungrouped