Class: Vertx::CompositeFuture

Inherits:
Future
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb

Overview

The composite future wraps a list of Futurefutures, it is useful when several futures needs to be coordinated.

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)


20
21
22
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 20

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)


273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 273

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)


318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 318

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



29
30
31
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 29

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



32
33
34
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 32

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)


363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 363

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)



26
27
28
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 26

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

+ (Object) wrap(obj)



23
24
25
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 23

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)


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

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)


49
50
51
52
53
54
55
56
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 49

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)


38
39
40
41
42
43
44
45
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 38

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)


193
194
195
196
197
198
199
200
201
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 193

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) { ... } - (::Vertx::Future) compose(handler)

Compose this future with a provided next future.

When this (the one on which compose is called) future succeeds, the handler will be called with the completed value, this handler should complete the next future.

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

When this future fails, the failure will be propagated to the next future and the handler will not be called.

Overloads:

Returns:

Raises:

  • (ArgumentError)


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

def compose(param_1=nil,param_2=nil)
  if block_given? && param_1 == nil && param_2 == 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 param_1.class == Proc && param_2.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:compose, [Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Future.java_class]).call((Proc.new { |event| param_1.call(::Vertx::Util::Utils.safe_create(event,::Vertx::CompositeFuture)) }),param_2.j_del),::Vertx::Future, nil)
  end
  raise ArgumentError, "Invalid arguments when calling compose(#{param_1},#{param_2})"
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)


63
64
65
66
67
68
69
70
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 63

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)


129
130
131
132
133
134
135
136
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 129

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)


170
171
172
173
174
175
176
177
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 170

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)


186
187
188
189
190
191
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 186

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)


222
223
224
225
226
227
228
229
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 222

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)


238
239
240
241
242
243
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 238

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)


206
207
208
209
210
211
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 206

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)


98
99
100
101
102
103
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 98

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)


391
392
393
394
395
396
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 391

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)


381
382
383
384
385
386
387
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 381

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)


398
399
400
401
402
403
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 398

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)


118
119
120
121
122
123
124
125
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 118

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)


74
75
76
77
78
79
80
81
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 74

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)


88
89
90
91
92
93
94
95
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/composite_future.rb', line 88

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