Class List Method List File List

# Class: Vertx::Context

Inherits:
  Object
  - Object
  - Vertx::Context
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb

## Class Method Summary (collapse)

- + (Boolean) on_event_loop_thread?
- + (Boolean) on_vertx_thread?
- + (Boolean) on_worker_thread?

## Instance Method Summary (collapse)

- - (Object) config
- - (Object) deployment_id
- - (Boolean) event_loop_context?
- - (Object) exception_handler
- - (Object) execute_blocking(blockingCodeHandler = nil, ordered = nil)
- - (Object) get(key = nil)
- - (Object) get_instance_count
- - (Context) initialize(j_del) constructor
  A new instance of Context.
- - (Object) j_del
- - (Boolean) multi_threaded_worker_context?
- - (Object) owner
- - (Object) process_args
- - (Object) put(key = nil, value = nil)
- - (Boolean) remove?(key = nil)
- - (Object) run_on_context
- - (Boolean) worker_context?

## Constructor Details

### - (`Context`) initialize(j_del)

Returns a new instance of Context

    39
    40
    41
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 39

    def initialize(j_del)
      @j_del = j_del
    end

## Class Method Details

### + (`Boolean`) on_event_loop_thread?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

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

    def self.on_event_loop_thread?
      if !block_given?
        return Java::IoVertxCore::Context.java_method(:isOnEventLoopThread, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling on_event_loop_thread?()"
    end

### + (`Boolean`) on_vertx_thread?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    71
    72
    73
    74
    75
    76
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 71

    def self.on_vertx_thread?
      if !block_given?
        return Java::IoVertxCore::Context.java_method(:isOnVertxThread, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling on_vertx_thread?()"
    end

### + (`Boolean`) on_worker_thread?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

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

    def self.on_worker_thread?
      if !block_given?
        return Java::IoVertxCore::Context.java_method(:isOnWorkerThread, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling on_worker_thread?()"
    end

## Instance Method Details

### - (`Object`) config

Raises:

- (`ArgumentError`)

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

    def config
      if !block_given?
        return @j_del.java_method(:config, []).call() != nil ? JSON.parse(@j_del.java_method(:config, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling config()"
    end

### - (`Object`) deployment_id

Raises:

- (`ArgumentError`)

    110
    111
    112
    113
    114
    115
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 110

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

### - (`Boolean`) event_loop_context?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    139
    140
    141
    142
    143
    144
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 139

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

### - (`Object`) exception_handler

Raises:

- (`ArgumentError`)

    214
    215
    216
    217
    218
    219
    220
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 214

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

### - (`Object`) execute_blocking(blockingCodeHandler = nil, ordered = nil)

Raises:

- (`ArgumentError`)

    100
    101
    102
    103
    104
    105
    106
    107
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 100

    def execute_blocking(blockingCodeHandler=nil,ordered=nil)
      if blockingCodeHandler.class == Proc && block_given? && ordered == nil
        return @j_del.java_method(:executeBlocking, [Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| blockingCodeHandler.call(::Vertx::Util::Utils.safe_create(event,::Vertx::Future)) }),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
      elsif blockingCodeHandler.class == Proc && (ordered.class == TrueClass || ordered.class == FalseClass) && block_given?
        return @j_del.java_method(:executeBlocking, [Java::IoVertxCore::Handler.java_class,Java::boolean.java_class,Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| blockingCodeHandler.call(::Vertx::Util::Utils.safe_create(event,::Vertx::Future)) }),ordered,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling execute_blocking(blockingCodeHandler,ordered)"
    end

### - (`Object`) get(key = nil)

Raises:

- (`ArgumentError`)

    168
    169
    170
    171
    172
    173
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 168

    def get(key=nil)
      if key.class == String && !block_given?
        return ::Vertx::Util::Utils.from_object(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(key))
      end
      raise ArgumentError, "Invalid arguments when calling get(key)"
    end

### - (`Object`) get_instance_count

Raises:

- (`ArgumentError`)

    203
    204
    205
    206
    207
    208
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 203

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

### - (`Object`) j_del

    44
    45
    46
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 44

    def j_del
      @j_del
    end

### - (`Boolean`) multi_threaded_worker_context?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    159
    160
    161
    162
    163
    164
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 159

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

### - (`Object`) owner

Raises:

- (`ArgumentError`)

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

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

### - (`Object`) process_args

Raises:

- (`ArgumentError`)

    127
    128
    129
    130
    131
    132
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 127

    def process_args
      if !block_given?
        return @j_del.java_method(:processArgs, []).call().to_a.map { |elt| elt }
      end
      raise ArgumentError, "Invalid arguments when calling process_args()"
    end

### - (`Object`) put(key = nil, value = nil)

Raises:

- (`ArgumentError`)

    180
    181
    182
    183
    184
    185
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 180

    def put(key=nil,value=nil)
      if key.class == String && (value.class == String  || value.class == Hash || value.class == Array || value.class == NilClass || value.class == TrueClass || value.class == FalseClass || value.class == Fixnum || value.class == Float) && !block_given?
        return @j_del.java_method(:put, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class]).call(key,::Vertx::Util::Utils.to_object(value))
      end
      raise ArgumentError, "Invalid arguments when calling put(key,value)"
    end

### - (`Boolean`) remove?(key = nil)

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    189
    190
    191
    192
    193
    194
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 189

    def remove?(key=nil)
      if key.class == String && !block_given?
        return @j_del.java_method(:remove, [Java::java.lang.String.java_class]).call(key)
      end
      raise ArgumentError, "Invalid arguments when calling remove?(key)"
    end

### - (`Object`) run_on_context

Raises:

- (`ArgumentError`)

    80
    81
    82
    83
    84
    85
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 80

    def run_on_context
      if block_given?
        return @j_del.java_method(:runOnContext, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
      end
      raise ArgumentError, "Invalid arguments when calling run_on_context()"
    end

### - (`Boolean`) worker_context?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    151
    152
    153
    154
    155
    156
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/context.rb', line 151

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