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)

282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 282

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)

327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 327

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)

372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 372

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)

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

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(successMapper = nil, failureMapper = nil) { ... }

Compose this future with a successMapper and failureMapper functions.

When this future (the one on which compose is called) succeeds, the successMapper 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.

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

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

Parameters:

  • successMapper (Proc) (defaults to: nil)
    the function mapping the success

Yields:

  • the function mapping the failure

Returns:

Raises:

  • (ArgumentError)

161
162
163
164
165
166
167
168
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 161

def compose(successMapper=nil,failureMapper=nil)
  if block_given? && successMapper == nil && failureMapper == 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)
  elsif successMapper.class == Proc && block_given? && failureMapper == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:compose, [Java::JavaUtilFunction::Function.java_class,Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| successMapper.call(::Vertx::Util::Utils.safe_create(event,::Vertx::CompositeFuture)).j_del }),(Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)).j_del })),::Vertx::Future, nil)
  end
  raise ArgumentError, "Invalid arguments when calling compose(#{successMapper},#{failureMapper})"
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) flat_map(mapper = nil) { ... }

Alias for Future#compose.

Yields:

Returns:

Raises:

  • (ArgumentError)

141
142
143
144
145
146
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 141

def flat_map(mapper=nil)
  if block_given? && mapper == nil
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:flatMap, [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 flat_map(#{mapper})"
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)

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

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)

195
196
197
198
199
200
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 195

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

- (self) on_complete { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

399
400
401
402
403
404
405
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 399

def on_complete
  if block_given?
    @j_del.java_method(:onComplete, [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 on_complete()"
end

- (self) on_failure { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

417
418
419
420
421
422
423
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 417

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

- (self) on_success { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)

408
409
410
411
412
413
414
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 408

def on_success
  if block_given?
    @j_del.java_method(:onSuccess, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::Vertx::CompositeFuture)) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling on_success()"
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)

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

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)

247
248
249
250
251
252
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 247

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)

215
216
217
218
219
220
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 215

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)

427
428
429
430
431
432
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 427

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)

390
391
392
393
394
395
396
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 390

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)

434
435
436
437
438
439
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/composite_future.rb', line 434

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