Class: VertxHealthChecks::HealthChecks

Inherits:
Object
  • Object
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)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


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

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

+ (::VertxHealthChecks::HealthChecks) create(vertx)

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

Parameters:

Returns:



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

def self.create(*args)
  if args[0].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(args[0].j_del),::VertxHealthChecks::HealthChecks)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling create(#{args[0]})"
  end
end

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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

Instance Method Details

- (self) invoke(resultHandler) { ... } - (self) invoke(name, resultHandler) { ... }

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

Overloads:

  • - (self) invoke(resultHandler) { ... }

    Yields:

    • the result handler, must not be null. The handler received the computed .
  • - (self) invoke(name, resultHandler) { ... }

    Parameters:

    • name (String)

    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)


71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 71

def invoke(*args)
  if true && args[0] == nil
    @j_del.java_method(:invoke, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.encode) : nil) unless !block_given? }))
    return self
  elsif args[0].class == String && true
    if (block_given?)
      @j_del.java_method(:invoke, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise)
      return self
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:invoke, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result != nil ? JSON.parse(ar.result.encode) : nil : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling invoke(#{args[0]})"
  end
end

- (::VertxHealthChecks::HealthChecks) register(name, procedure) { ... } - (::VertxHealthChecks::HealthChecks) register(name, timeout, procedure) { ... }

Registers a health check procedure.

The procedure is a taking a of => Object} 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) => Object}, the procedure outcome is the received status.

Overloads:

  • - (::VertxHealthChecks::HealthChecks) register(name, procedure) { ... }

    Parameters:

    • name (String)
      the name of the procedure, must not be null or empty

    Yields:

    • the procedure, must not be null
  • - (::VertxHealthChecks::HealthChecks) register(name, timeout, procedure) { ... }

    Parameters:

    • name (String)
      the name of the procedure, must not be null or empty
    • timeout (Fixnum)
      the procedure timeout in milliseconds

    Yields:

    • the procedure, must not be null

Returns:



106
107
108
109
110
111
112
113
114
115
116
117
118
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 106

def register(*args)
  if args[0].class == String && true && args[1] == nil
    @j_del.java_method(:register, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(args[0],(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Promise,::Vertx::Util::data_object_type(Java::IoVertxExtHealthchecks::Status))) unless !block_given? }))
    return self
  elsif args[0].class == String && args[1].class == Fixnum && true
    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(args[0],args[1],(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::Promise,::Vertx::Util::data_object_type(Java::IoVertxExtHealthchecks::Status))) unless !block_given? })),::VertxHealthChecks::HealthChecks)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling register(#{args[0]},#{args[1]})"
  end
end

- (self) unregister(name)

Unregisters a procedure.

Parameters:

  • name (String)
    the name of the procedure

Returns:

  • (self)


38
39
40
41
42
43
44
45
46
47
48
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-health-checks/health_checks.rb', line 38

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