Class List Method List File List

# Class: VertxHealthChecks::HealthChecks

Inherits:
  Object
  - Object
  - VertxHealthChecks::HealthChecks
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (::VertxHealthChecks::HealthChecks) create(vertx = nil)
  Creates a new instance of the default implementation of HealthChecks.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (self) invoke(name = nil) { ... }
  Invokes the registered procedure with the given name and sub-procedures.
- - (::VertxHealthChecks::HealthChecks) register(name = nil, timeout = nil) { ... }
  Registers a health check procedure.
- - (self) unregister(name = nil)
  Unregisters a procedure.

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    18
    19
    20
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 18

    def @@j_api_type.accept?(obj)
      obj.class == HealthChecks
    end

### + (`::VertxHealthChecks::HealthChecks`) create(vertx = nil)

Creates a new instance of the default implementation of VertxHealthChecks::HealthChecks.

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`) —
  the instance of Vert.x, must not be `null`

Returns:

- (`::VertxHealthChecks::HealthChecks`) —
  the created instance

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 36

    def self.create(vertx=nil)
      if vertx.class.method_defined?(:j_del) && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtHealthchecks::HealthChecks.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxHealthChecks::HealthChecks)
      end
      raise ArgumentError, "Invalid arguments when calling create(#{vertx})"
    end

### + (`Object`) j_api_type

    27
    28
    29
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 27

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    30
    31
    32
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 30

    def self.j_class
      Java::IoVertxExtHealthchecks::HealthChecks.java_class
    end

### + (`Object`) unwrap(obj)

    24
    25
    26
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 24

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    21
    22
    23
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 21

    def @@j_api_type.wrap(obj)
      HealthChecks.new(obj)
    end

## Instance Method Details

### - (`self`) invoke(name = nil) { ... }

Invokes the registered procedure with the given name and sub-procedures. It computes the overall outcome.

Parameters:

- name (`String`) (defaults to: `nil`)

Yields:

- the result handler, must not be `null`. The handler received an marked as failed if the procedure with the given name cannot be found or invoked.

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 77

    def invoke(name=nil)
      if block_given? && name == nil
        @j_del.java_method(:invoke, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.encode) : nil) }))
        return self
      elsif name.class == String && block_given?
        @j_del.java_method(:invoke, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling invoke(#{name})"
    end

### - (`::VertxHealthChecks::HealthChecks`) register(name = nil, timeout = nil) { ... }

Registers a health check procedure.

The procedure is a taking a of Hash as parameter. Procedures are asynchronous, and must complete or fail the given . If the future object is failed, the procedure outcome is considered as `DOWN`. If the future is completed without any object, the procedure outcome is considered as `UP`. If the future is completed with a (not-null) Hash, the procedure outcome is the received status.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the name of the procedure, must not be `null` or empty
- timeout (`Fixnum`) (defaults to: `nil`) —
  the procedure timeout in milliseconds

Yields:

- the procedure, must not be `null`

Returns:

- (`::VertxHealthChecks::HealthChecks`) —
  the current VertxHealthChecks::HealthChecks

Raises:

- (`ArgumentError`)

    53
    54
    55
    56
    57
    58
    59
    60
    61
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 53

    def register(name=nil,timeout=nil)
      if name.class == String && block_given? && timeout == nil
        @j_del.java_method(:register, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtHealthchecks::Status))) }))
        return self
      elsif name.class == String && timeout.class == Fixnum && block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:register, [Java::java.lang.String.java_class,Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(name,timeout,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Future,::Vertx::Util::data_object_type(Java::IoVertxExtHealthchecks::Status))) })),::VertxHealthChecks::HealthChecks)
      end
      raise ArgumentError, "Invalid arguments when calling register(#{name},#{timeout})"
    end

### - (`self`) unregister(name = nil)

Unregisters a procedure.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the name of the procedure

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    71
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 65

    def unregister(name=nil)
      if name.class == String && !block_given?
        @j_del.java_method(:unregister, [Java::java.lang.String.java_class]).call(name)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling unregister(#{name})"
    end