Class List Method List File List

# Class: VertxUnit::Completion

Inherits:
  Object
  - Object
  - VertxUnit::Completion
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/completion.rb

## Overview

A completion object that emits completion notifications either succeeded or failed.

## Direct Known Subclasses

Async, TestCompletion

## Instance Method Summary (collapse)

- - (void) await(timeoutMillis = nil)
  Cause the current thread to wait until this completion completes with a configurable timeout.
- - (void) await_success(timeoutMillis = nil)
  Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.
- - (true, false) completed?
  True if this completion is completed.
- - (true, false) failed?
  True if the this completion is completed and failed.
- - (void) handler { ... }
  Completion handler to receive a completion signal when this completions completes.
- - (void) resolve(future = nil)
  Completes the future upon completion, otherwise fails it.
- - (true, false) succeeded?
  True if this completion is completed and succeeded.

## Instance Method Details

### - (`void`) await(timeoutMillis = nil)

This method returns an undefined value.

Cause the current thread to wait until this completion completes with a configurable timeout.

If completion times out or the current thread is interrupted, an exception will be thrown.

Parameters:

- timeoutMillis (`Fixnum`) (defaults to: `nil`) —
  the timeout in milliseconds

Raises:

- (`ArgumentError`)

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

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

### - (`void`) await_success(timeoutMillis = nil)

This method returns an undefined value.

Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.

If completion times out or the current thread is interrupted or the suite fails, an exception will be thrown.

Parameters:

- timeoutMillis (`Fixnum`) (defaults to: `nil`) —
  the timeout in milliseconds

Raises:

- (`ArgumentError`)

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

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

### - (`true`, `false`) completed?

Returns true if this completion is completed

Returns:

- (`true`, `false`) —
  true if this completion is completed

Raises:

- (`ArgumentError`)

    28
    29
    30
    31
    32
    33
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/completion.rb', line 28

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

### - (`true`, `false`) failed?

Returns true if the this completion is completed and failed

Returns:

- (`true`, `false`) —
  true if the this completion is completed and failed

Raises:

- (`ArgumentError`)

    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/completion.rb', line 42

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

### - (`void`) handler { ... }

This method returns an undefined value.

Completion handler to receive a completion signal when this completions completes.

Yields:

- the completion handler

Raises:

- (`ArgumentError`)

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

    def handler
      if block_given?
        return @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_T.wrap(ar.result) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling handler()"
    end

### - (`void`) resolve(future = nil)

This method returns an undefined value.

Completes the future upon completion, otherwise fails it.

Parameters:

- future (`::Vertx::Future`) (defaults to: `nil`) —
  the future to resolve

Raises:

- (`ArgumentError`)

    21
    22
    23
    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/completion.rb', line 21

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

### - (`true`, `false`) succeeded?

Returns true if this completion is completed and succeeded

Returns:

- (`true`, `false`) —
  true if this completion is completed and succeeded

Raises:

- (`ArgumentError`)

    35
    36
    37
    38
    39
    40
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-unit/completion.rb', line 35

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