Class List Method List File List

# Class: VertxCircuitBreaker::CircuitBreaker

Inherits:
  Object
  - Object
  - VertxCircuitBreaker::CircuitBreaker
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb

## Class Method Summary (collapse)

- + (Object) create(name = nil, vertx = nil, options = nil)

## Instance Method Summary (collapse)

- - (Object) close
- - (Object) close_handler
- - (Object) execute
- - (Object) execute_and_report(resultFuture = nil)
- - (Object) execute_and_report_with_fallback(resultFuture = nil, operation = nil, fallback = nil)
- - (Object) execute_with_fallback(operation = nil, fallback = nil)
- - (Object) failure_count
- - (Object) fallback(handler = nil)
- - (Object) half_open_handler
- - (CircuitBreaker) initialize(j_del) constructor
  A new instance of CircuitBreaker.
- - (Object) j_del
- - (Object) name
- - (Object) open
- - (Object) open_handler
- - (Object) reset
- - (Object) state

## Constructor Details

### - (`CircuitBreaker`) initialize(j_del)

Returns a new instance of CircuitBreaker

    10
    11
    12
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 10

    def initialize(j_del)
      @j_del = j_del
    end

## Class Method Details

### + (`Object`) create(name = nil, vertx = nil, options = nil)

Raises:

- (`ArgumentError`)

    23
    24
    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 23

    def self.create(name=nil,vertx=nil,options=nil)
      if name.class == String && vertx.class.method_defined?(:j_del) && !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCircuitbreaker::CircuitBreaker.java_method(:create, [Java::java.lang.String.java_class,Java::IoVertxCore::Vertx.java_class]).call(name,vertx.j_del),::VertxCircuitBreaker::CircuitBreaker)
      elsif name.class == String && vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCircuitbreaker::CircuitBreaker.java_method(:create, [Java::java.lang.String.java_class,Java::IoVertxCore::Vertx.java_class,Java::IoVertxCircuitbreaker::CircuitBreakerOptions.java_class]).call(name,vertx.j_del,Java::IoVertxCircuitbreaker::CircuitBreakerOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxCircuitBreaker::CircuitBreaker)
      end
      raise ArgumentError, "Invalid arguments when calling create(name,vertx,options)"
    end

## Instance Method Details

### - (`Object`) close

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    41
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 35

    def close
      if !block_given?
        @j_del.java_method(:close, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`Object`) close_handler

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    71
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 65

    def close_handler
      if block_given?
        @j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling close_handler()"
    end

### - (`Object`) execute

Raises:

- (`ArgumentError`)

    96
    97
    98
    99
    100
    101
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 96

    def execute
      if block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:execute, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Future)) })),::Vertx::Future)
      end
      raise ArgumentError, "Invalid arguments when calling execute()"
    end

### - (`Object`) execute_and_report(resultFuture = nil)

Raises:

- (`ArgumentError`)

    107
    108
    109
    110
    111
    112
    113
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 107

    def execute_and_report(resultFuture=nil)
      if resultFuture.class.method_defined?(:j_del) && block_given?
        @j_del.java_method(:executeAndReport, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Handler.java_class]).call(resultFuture.j_del,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Future)) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling execute_and_report(resultFuture)"
    end

### - (`Object`) execute_and_report_with_fallback(resultFuture = nil, operation = nil, fallback = nil)

Raises:

- (`ArgumentError`)

    131
    132
    133
    134
    135
    136
    137
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 131

    def execute_and_report_with_fallback(resultFuture=nil,operation=nil,fallback=nil)
      if resultFuture.class.method_defined?(:j_del) && operation.class == Proc && block_given? && fallback == nil
        @j_del.java_method(:executeAndReportWithFallback, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Handler.java_class,Java::JavaUtilFunction::Function.java_class]).call(resultFuture.j_del,(Proc.new { |event| operation.call(::Vertx::Util::Utils.safe_create(event,::Vertx::Future)) }),(Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.from_throwable(event))) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling execute_and_report_with_fallback(resultFuture,operation,fallback)"
    end

### - (`Object`) execute_with_fallback(operation = nil, fallback = nil)

Raises:

- (`ArgumentError`)

    87
    88
    89
    90
    91
    92
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 87

    def execute_with_fallback(operation=nil,fallback=nil)
      if operation.class == Proc && block_given? && fallback == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:executeWithFallback, [Java::IoVertxCore::Handler.java_class,Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| operation.call(::Vertx::Util::Utils.safe_create(event,::Vertx::Future)) }),(Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.from_throwable(event))) })),::Vertx::Future)
      end
      raise ArgumentError, "Invalid arguments when calling execute_with_fallback(operation,fallback)"
    end

### - (`Object`) failure_count

Raises:

- (`ArgumentError`)

    177
    178
    179
    180
    181
    182
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 177

    def failure_count
      if !block_given?
        return @j_del.java_method(:failureCount, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling failure_count()"
    end

### - (`Object`) fallback(handler = nil)

Raises:

- (`ArgumentError`)

    144
    145
    146
    147
    148
    149
    150
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 144

    def fallback(handler=nil)
      if block_given? && handler == nil
        @j_del.java_method(:fallback, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.from_throwable(event))) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling fallback(handler)"
    end

### - (`Object`) half_open_handler

Raises:

- (`ArgumentError`)

    55
    56
    57
    58
    59
    60
    61
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 55

    def half_open_handler
      if block_given?
        @j_del.java_method(:halfOpenHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling half_open_handler()"
    end

### - (`Object`) j_del

    15
    16
    17
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 15

    def j_del
      @j_del
    end

### - (`Object`) name

Raises:

- (`ArgumentError`)

    184
    185
    186
    187
    188
    189
    190
    191
    192
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 184

    def name
      if !block_given?
        if @cached_name != nil
          return @cached_name
        end
        return @cached_name = @j_del.java_method(:name, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling name()"
    end

### - (`Object`) open

Raises:

- (`ArgumentError`)

    162
    163
    164
    165
    166
    167
    168
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 162

    def open
      if !block_given?
        @j_del.java_method(:open, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling open()"
    end

### - (`Object`) open_handler

Raises:

- (`ArgumentError`)

    45
    46
    47
    48
    49
    50
    51
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 45

    def open_handler
      if block_given?
        @j_del.java_method(:openHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling open_handler()"
    end

### - (`Object`) reset

Raises:

- (`ArgumentError`)

    153
    154
    155
    156
    157
    158
    159
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 153

    def reset
      if !block_given?
        @j_del.java_method(:reset, []).call()
        return self
      end
      raise ArgumentError, "Invalid arguments when calling reset()"
    end

### - (`Object`) state

Raises:

- (`ArgumentError`)

    170
    171
    172
    173
    174
    175
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-circuit-breaker/circuit_breaker.rb', line 170

    def state
      if !block_given?
        return @j_del.java_method(:state, []).call().name.intern
      end
      raise ArgumentError, "Invalid arguments when calling state()"
    end