Class: Vertx::CompositeFuture

Inherits:
Future
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb

Overview

The composite future wraps a list of Futurefutures, it is useful when several futures needs to be coordinated. The handlers set for the coordinated futures are overridden by the handler of the composite future.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Future

failed_future, future, succeeded_future

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)

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

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

+ (::Vertx::CompositeFuture) all(futures) + (::Vertx::CompositeFuture) all(f1, f2) + (::Vertx::CompositeFuture) all(f1, f2, f3) + (::Vertx::CompositeFuture) all(f1, f2, f3, f4) + (::Vertx::CompositeFuture) all(f1, f2, f3, f4, f5) + (::Vertx::CompositeFuture) all(f1, f2, f3, f4, f5, f6)

Like #all but with 6 futures.

Overloads:

Returns:

Raises:

  • (ArgumentError)

269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 269

def self.all(param_1=nil,param_2=nil,param_3=nil,param_4=nil,param_5=nil,param_6=nil)
  if param_1.class == Array && !block_given? && param_2 == nil && param_3 == nil && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:all, [Java::JavaUtil::List.java_class]).call(param_1.map { |element| element.j_del }),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && !block_given? && param_3 == nil && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:all, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && !block_given? && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:all, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && !block_given? && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:all, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && param_5.class.method_defined?(:j_del) && !block_given? && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:all, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del,param_5.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && param_5.class.method_defined?(:j_del) && param_6.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:all, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del,param_5.j_del,param_6.j_del),::Vertx::CompositeFuture)
  end
  raise ArgumentError, "Invalid arguments when calling all(#{param_1},#{param_2},#{param_3},#{param_4},#{param_5},#{param_6})"
end

+ (::Vertx::CompositeFuture) any(futures) + (::Vertx::CompositeFuture) any(f1, f2) + (::Vertx::CompositeFuture) any(f1, f2, f3) + (::Vertx::CompositeFuture) any(f1, f2, f3, f4) + (::Vertx::CompositeFuture) any(f1, f2, f3, f4, f5) + (::Vertx::CompositeFuture) any(f1, f2, f3, f4, f5, f6)

Like #any but with 6 futures.

Overloads:

Returns:

Raises:

  • (ArgumentError)

314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 314

def self.any(param_1=nil,param_2=nil,param_3=nil,param_4=nil,param_5=nil,param_6=nil)
  if param_1.class == Array && !block_given? && param_2 == nil && param_3 == nil && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:any, [Java::JavaUtil::List.java_class]).call(param_1.map { |element| element.j_del }),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && !block_given? && param_3 == nil && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:any, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && !block_given? && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:any, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && !block_given? && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:any, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && param_5.class.method_defined?(:j_del) && !block_given? && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:any, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del,param_5.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && param_5.class.method_defined?(:j_del) && param_6.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:any, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del,param_5.j_del,param_6.j_del),::Vertx::CompositeFuture)
  end
  raise ArgumentError, "Invalid arguments when calling any(#{param_1},#{param_2},#{param_3},#{param_4},#{param_5},#{param_6})"
end

+ (Object) j_api_type


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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 33

def self.j_class
  Java::IoVertxCore::CompositeFuture.java_class
end

+ (::Vertx::CompositeFuture) join(futures) + (::Vertx::CompositeFuture) join(f1, f2) + (::Vertx::CompositeFuture) join(f1, f2, f3) + (::Vertx::CompositeFuture) join(f1, f2, f3, f4) + (::Vertx::CompositeFuture) join(f1, f2, f3, f4, f5) + (::Vertx::CompositeFuture) join(f1, f2, f3, f4, f5, f6)

Like #join but with 6 futures.

Overloads:

Returns:

Raises:

  • (ArgumentError)

359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 359

def self.join(param_1=nil,param_2=nil,param_3=nil,param_4=nil,param_5=nil,param_6=nil)
  if param_1.class == Array && !block_given? && param_2 == nil && param_3 == nil && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:join, [Java::JavaUtil::List.java_class]).call(param_1.map { |element| element.j_del }),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && !block_given? && param_3 == nil && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:join, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && !block_given? && param_4 == nil && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:join, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && !block_given? && param_5 == nil && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:join, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && param_5.class.method_defined?(:j_del) && !block_given? && param_6 == nil
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:join, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del,param_5.j_del),::Vertx::CompositeFuture)
  elsif param_1.class.method_defined?(:j_del) && param_2.class.method_defined?(:j_del) && param_3.class.method_defined?(:j_del) && param_4.class.method_defined?(:j_del) && param_5.class.method_defined?(:j_del) && param_6.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::CompositeFuture.java_method(:join, [Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class,Java::IoVertxCore::Future.java_class]).call(param_1.j_del,param_2.j_del,param_3.j_del,param_4.j_del,param_5.j_del,param_6.j_del),::Vertx::CompositeFuture)
  end
  raise ArgumentError, "Invalid arguments when calling join(#{param_1},#{param_2},#{param_3},#{param_4},#{param_5},#{param_6})"
end

+ (Object) unwrap(obj)


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

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

+ (Object) wrap(obj)


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

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

Instance Method Details

- (Exception) cause(index = nil)

Returns a cause of a wrapped future

Parameters:

  • index (Fixnum) (defaults to: nil)
    the wrapped future index

Returns:

  • (Exception)

Raises:

  • (ArgumentError)

108
109
110
111
112
113
114
115
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 108

def cause(index=nil)
  if !block_given? && index == nil
    return ::Vertx::Util::Utils.from_throwable(@j_del.java_method(:cause, []).call())
  elsif index.class == Fixnum && !block_given?
    return ::Vertx::Util::Utils.from_throwable(@j_del.java_method(:cause, [Java::int.java_class]).call(index))
  end
  raise ArgumentError, "Invalid arguments when calling cause(#{index})"
end

- (void) complete(result = nil)

This method returns an undefined value.

Set the result. Any handler will be called, if there is one, and the future will be marked as completed.

Parameters:

Raises:

  • (ArgumentError)

50
51
52
53
54
55
56
57
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 50

def complete(result=nil)
  if !block_given? && result == nil
    return @j_del.java_method(:complete, []).call()
  elsif result.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:complete, [Java::IoVertxCore::CompositeFuture.java_class]).call(result.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling complete(#{result})"
end

- (true, false) complete?(index = nil)

Returns true if a wrapped future is completed

Parameters:

  • index (Fixnum) (defaults to: nil)
    the wrapped future index

Returns:

  • (true, false)

Raises:

  • (ArgumentError)

39
40
41
42
43
44
45
46
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 39

def complete?(index=nil)
  if !block_given? && index == nil
    return @j_del.java_method(:isComplete, []).call()
  elsif index.class == Fixnum && !block_given?
    return @j_del.java_method(:isComplete, [Java::int.java_class]).call(index)
  end
  raise ArgumentError, "Invalid arguments when calling complete?(#{index})"
end

- (Proc) completer

Returns an handler completing this future

Returns:

  • (Proc)
    an handler completing this future

Raises:

  • (ArgumentError)

189
190
191
192
193
194
195
196
197
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 189

def completer
  if !block_given?
    if @cached_completer != nil
      return @cached_completer
    end
    return @cached_completer = ::Vertx::Util::Utils.to_async_result_handler_proc(@j_del.java_method(:completer, []).call()) { |val| val.j_del }
  end
  raise ArgumentError, "Invalid arguments when calling completer()"
end

- (::Vertx::Future) compose(mapper = nil) { ... }

Compose this future with a mapper function.

When this future (the one on which compose is called) succeeds, the mapper will be called with the completed value and this mapper returns another future object. This returned future completion will complete the future returned by this method call.

If the mapper throws an exception, the returned future will be failed with this exception.

When this future fails, the failure will be propagated to the returned future and the mapper will not be called.

Yields:

  • the mapper function

Returns:

Raises:

  • (ArgumentError)

150
151
152
153
154
155
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 150

def compose(mapper=nil)
  if block_given? && mapper == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:compose, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::CompositeFuture)).j_del })),::Vertx::Future, nil)
  end
  raise ArgumentError, "Invalid arguments when calling compose(#{mapper})"
end

- (void) fail(cause) - (void) fail(failureMessage)

This method returns an undefined value.

Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.

Overloads:

  • - (void) fail(cause)

    Parameters:

    • cause (Exception)
      the failure cause
  • - (void) fail(failureMessage)

    Parameters:

    • failureMessage (String)
      the failure message

Raises:

  • (ArgumentError)

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

def fail(param_1=nil)
  if param_1.is_a?(Exception) && !block_given?
    return @j_del.java_method(:fail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1))
  elsif param_1.class == String && !block_given?
    return @j_del.java_method(:fail, [Java::java.lang.String.java_class]).call(param_1)
  end
  raise ArgumentError, "Invalid arguments when calling fail(#{param_1})"
end

- (true, false) failed?(index = nil)

Returns true if a wrapped future is failed

Parameters:

  • index (Fixnum) (defaults to: nil)
    the wrapped future index

Returns:

  • (true, false)

Raises:

  • (ArgumentError)

130
131
132
133
134
135
136
137
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 130

def failed?(index=nil)
  if !block_given? && index == nil
    return @j_del.java_method(:failed, []).call()
  elsif index.class == Fixnum && !block_given?
    return @j_del.java_method(:failed, [Java::int.java_class]).call(index)
  end
  raise ArgumentError, "Invalid arguments when calling failed?(#{index})"
end

- (::Vertx::Future) map(mapper) { ... } - (::Vertx::Future) map(value)

Map the result of a future to a specific value.

When this future succeeds, this value will complete the future returned by this method call.

When this future fails, the failure will be propagated to the returned future.

Overloads:

  • - (::Vertx::Future) map(mapper) { ... }

    Yields:

    • the mapper function
  • - (::Vertx::Future) map(value)

    Parameters:

    • value (Object)
      the value that eventually completes the mapped future

Returns:

Raises:

  • (ArgumentError)

166
167
168
169
170
171
172
173
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 166

def map(param_1=nil)
  if block_given? && param_1 == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:map, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.safe_create(event,::Vertx::CompositeFuture))) })),::Vertx::Future, nil)
  elsif ::Vertx::Util::unknown_type.accept?(param_1) && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:map, [Java::java.lang.Object.java_class]).call(::Vertx::Util::Utils.to_object(param_1)),::Vertx::Future, nil)
  end
  raise ArgumentError, "Invalid arguments when calling map(#{param_1})"
end

- (::Vertx::Future) map_empty

Map the result of a future to null.

This is a conveniency for future.map((T) null) or future.map((Void) null).

When this future succeeds, null will complete the future returned by this method call.

When this future fails, the failure will be propagated to the returned future.

Returns:

Raises:

  • (ArgumentError)

182
183
184
185
186
187
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 182

def map_empty
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:mapEmpty, []).call(),::Vertx::Future, nil)
  end
  raise ArgumentError, "Invalid arguments when calling map_empty()"
end

- (::Vertx::Future) otherwise(mapper) { ... } - (::Vertx::Future) otherwise(value)

Map the failure of a future to a specific value.

When this future fails, this value will complete the future returned by this method call.

When this future succeeds, the result will be propagated to the returned future.

Overloads:

Returns:

Raises:

  • (ArgumentError)

218
219
220
221
222
223
224
225
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 218

def otherwise(param_1=nil)
  if block_given? && param_1 == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:otherwise, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)).j_del })),::Vertx::Future,::Vertx::CompositeFuture.j_api_type)
  elsif param_1.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:otherwise, [Java::IoVertxCore::CompositeFuture.java_class]).call(param_1.j_del),::Vertx::Future,::Vertx::CompositeFuture.j_api_type)
  end
  raise ArgumentError, "Invalid arguments when calling otherwise(#{param_1})"
end

- (::Vertx::Future) otherwise_empty

Map the failure of a future to null.

This is a convenience for future.otherwise((T) null).

When this future fails, the null value will complete the future returned by this method call.

When this future succeeds, the result will be propagated to the returned future.

Returns:

Raises:

  • (ArgumentError)

234
235
236
237
238
239
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 234

def otherwise_empty
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:otherwiseEmpty, []).call(),::Vertx::Future,::Vertx::CompositeFuture.j_api_type)
  end
  raise ArgumentError, "Invalid arguments when calling otherwise_empty()"
end

- (::Vertx::Future) recover(mapper = nil) { ... }

Handles a failure of this Future by returning the result of another Future. If the mapper fails, then the returned future will be failed with this failure.

Yields:

  • A function which takes the exception of a failure and returns a new future.

Returns:

Raises:

  • (ArgumentError)

202
203
204
205
206
207
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 202

def recover(mapper=nil)
  if block_given? && mapper == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:recover, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)).j_del })),::Vertx::Future,::Vertx::CompositeFuture.j_api_type)
  end
  raise ArgumentError, "Invalid arguments when calling recover(#{mapper})"
end

- (::Vertx::CompositeFuture) result

The result of the operation. This will be null if the operation failed.

Returns:

Raises:

  • (ArgumentError)

99
100
101
102
103
104
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 99

def result
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:result, []).call(),::Vertx::CompositeFuture)
  end
  raise ArgumentError, "Invalid arguments when calling result()"
end

- (Object) result_at(index = nil)

Returns the result of a wrapped future

Parameters:

  • index (Fixnum) (defaults to: nil)
    the wrapped future index

Returns:

  • (Object)

Raises:

  • (ArgumentError)

387
388
389
390
391
392
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 387

def result_at(index=nil)
  if index.class == Fixnum && !block_given?
    return ::Vertx::Util::Utils.from_object(@j_del.java_method(:resultAt, [Java::int.java_class]).call(index))
  end
  raise ArgumentError, "Invalid arguments when calling result_at(#{index})"
end

- (self) set_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

377
378
379
380
381
382
383
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 377

def set_handler
  if block_given?
    @j_del.java_method(:setHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::CompositeFuture) : nil) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling set_handler()"
end

- (Fixnum) size

Returns the number of wrapped future

Returns:

  • (Fixnum)
    the number of wrapped future

Raises:

  • (ArgumentError)

394
395
396
397
398
399
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 394

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

- (true, false) succeeded?(index = nil)

Returns true if a wrapped future is succeeded

Parameters:

  • index (Fixnum) (defaults to: nil)
    the wrapped future index

Returns:

  • (true, false)

Raises:

  • (ArgumentError)

119
120
121
122
123
124
125
126
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 119

def succeeded?(index=nil)
  if !block_given? && index == nil
    return @j_del.java_method(:succeeded, []).call()
  elsif index.class == Fixnum && !block_given?
    return @j_del.java_method(:succeeded, [Java::int.java_class]).call(index)
  end
  raise ArgumentError, "Invalid arguments when calling succeeded?(#{index})"
end

- (true, false) try_complete?(result = nil)

Set the failure. Any handler will be called, if there is one, and the future will be marked as completed.

Parameters:

Returns:

  • (true, false)
    false when the future is already completed

Raises:

  • (ArgumentError)

75
76
77
78
79
80
81
82
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 75

def try_complete?(result=nil)
  if !block_given? && result == nil
    return @j_del.java_method(:tryComplete, []).call()
  elsif result.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:tryComplete, [Java::IoVertxCore::CompositeFuture.java_class]).call(result.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling try_complete?(#{result})"
end

- (true, false) tryFail(cause) - (true, false) tryFail(failureMessage)

Try to set the failure. When it happens, any handler will be called, if there is one, and the future will be marked as completed.

Overloads:

  • - (true, false) tryFail(cause)

    Parameters:

    • cause (Exception)
      the failure cause
  • - (true, false) tryFail(failureMessage)

    Parameters:

    • failureMessage (String)
      the failure message

Returns:

  • (true, false)
    false when the future is already completed

Raises:

  • (ArgumentError)

89
90
91
92
93
94
95
96
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 89

def try_fail?(param_1=nil)
  if param_1.is_a?(Exception) && !block_given?
    return @j_del.java_method(:tryFail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1))
  elsif param_1.class == String && !block_given?
    return @j_del.java_method(:tryFail, [Java::java.lang.String.java_class]).call(param_1)
  end
  raise ArgumentError, "Invalid arguments when calling try_fail?(#{param_1})"
end