Class List Method List File List

# Class: Vertx::Vertx

Inherits:
  Object
  - Object
  - Vertx::Vertx
  show all
Includes:
  Measured
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb

## Overview

The entry point into the Vert.x Core API.

You use an instance of this class for functionality including:

- Creating TCP clients and servers
- Creating HTTP clients and servers
- Creating DNS clients
- Creating Datagram sockets
- Setting and cancelling periodic and one-shot timers
- Getting a reference to the event bus API
- Getting a reference to the file system API
- Getting a reference to the shared data API
- Deploying and undeploying verticles

Most functionality in Vert.x core is fairly low level.

To create an instance of this class you can use the static factory methods: #vertx, #vertx and #clustered_vertx.

Please see the user manual for more detailed usage information.

## Class Method Summary (collapse)

- + (void) clustered_vertx(options = nil) { ... }
  Creates a clustered instance using the specified options.
- + (::Vertx::Context) current_context
  Gets the current context.
- + (::Vertx::Vertx) vertx(options = nil)
  Creates a non clustered instance using the specified options.

## Instance Method Summary (collapse)

- - (true, false) cancel_timer?(id = nil)
  Cancels the timer with the specified id.
- - (void) close { ... }
  Like #close but the completionHandler will be called when the close is complete.
- - (true, false) clustered?
  Is this Vert.x instance clustered?.
- - (::Vertx::DatagramSocket) create_datagram_socket(options = nil)
  Create a datagram socket using the specified options.
- - (::Vertx::DnsClient) create_dns_client(port = nil, host = nil)
  Create a DNS client to connect to a DNS server at the specified host and port.
- - (::Vertx::HttpClient) create_http_client(options = nil)
  Create a HTTP/HTTPS client using the specified options.
- - (::Vertx::HttpServer) create_http_server(options = nil)
  Create an HTTP/HTTPS server using the specified options.
- - (::Vertx::NetClient) create_net_client(options = nil)
  Create a TCP/SSL client using the specified options.
- - (::Vertx::NetServer) create_net_server(options = nil)
  Create a TCP/SSL server using the specified options.
- - (void) deploy_verticle(name = nil, options = nil) { ... }
  Like #deploy_verticle but Hash are provided to configure the deployment.
- - (Set<String>) deployment_i_ds
  Return a Set of deployment IDs for the currently deployed deploymentIDs.
- - (::Vertx::EventBus) event_bus
  Get the event bus object.
- - (void) execute_blocking(blockingCodeHandler = nil, ordered = nil) { ... }
  Safely execute some blocking code.
- - (::Vertx::FileSystem) file_system
  Get the filesystem object.
- - (::Vertx::Context) get_or_create_context
  Gets the current context, or creates one if there isn't one.
- - (true, false) metrics_enabled?
  Whether the metrics are enabled for this measured object.
- - (::Vertx::TimeoutStream) periodic_stream(delay = nil)
  Returns a periodic timer as a read stream.
- - (void) run_on_context { ... }
  Puts the handler on the event queue for the current context so it will be run asynchronously ASAP after all preceeding events have been handled.
- - (Fixnum) set_periodic(delay = nil) { ... }
  Set a periodic timer to fire every delay milliseconds, at which point handler will be called with the id of the timer.
- - (Fixnum) set_timer(delay = nil) { ... }
  Set a one-shot timer to fire after delay milliseconds, at which point handler will be called with the id of the timer.
- - (::Vertx::SharedData) shared_data
  Get the shared data object.
- - (::Vertx::TimeoutStream) timer_stream(delay = nil)
  Returns a one-shot timer as a read stream.
- - (void) undeploy(deploymentID = nil) { ... }
  Like #undeploy(String) but the completionHandler will be notified when the undeployment is complete.

## Class Method Details

### + (`void`) clustered_vertx(options = nil) { ... }

This method returns an undefined value.

Creates a clustered instance using the specified options.

The instance is created asynchronously and the resultHandler is called with the result when it is ready.

Parameters:

- options (`Hash`) (defaults to: `nil`) —
  the options to use

Yields:

- the result handler that will receive the result

Raises:

- (`ArgumentError`)

    75
    76
    77
    78
    79
    80
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 75

    def self.clustered_vertx(options=nil)
      if options.class == Hash && block_given?
        return Java::IoVertxCore::Vertx.java_method(:clusteredVertx, [Java::IoVertxCore::VertxOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxCore::VertxOptions.new(::Vertx::Util::Utils.to_json_object(options)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Vertx) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling clustered_vertx(options)"
    end

### + (`::Vertx::Context`) current_context

Gets the current context

Returns:

- (`::Vertx::Context`) —
  The current context or null if no current context

Raises:

- (`ArgumentError`)

    83
    84
    85
    86
    87
    88
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 83

    def self.current_context
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::Vertx.java_method(:currentContext, []).call(),::Vertx::Context)
      end
      raise ArgumentError, "Invalid arguments when calling current_context()"
    end

### + (`::Vertx::Vertx`) vertx(options = nil)

Creates a non clustered instance using the specified options

Parameters:

- options (`Hash`) (defaults to: `nil`) —
  the options to use

Returns:

- (`::Vertx::Vertx`) —
  the instance

Raises:

- (`ArgumentError`)

    61
    62
    63
    64
    65
    66
    67
    68
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 61

    def self.vertx(options=nil)
      if !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::Vertx.java_method(:vertx, []).call(),::Vertx::Vertx)
      elsif options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::Vertx.java_method(:vertx, [Java::IoVertxCore::VertxOptions.java_class]).call(Java::IoVertxCore::VertxOptions.new(::Vertx::Util::Utils.to_json_object(options))),::Vertx::Vertx)
      end
      raise ArgumentError, "Invalid arguments when calling vertx(options)"
    end

## Instance Method Details

### - (`true`, `false`) cancel_timer?(id = nil)

Cancels the timer with the specified `id`.

Parameters:

- id (`Fixnum`) (defaults to: `nil`) —
  The id of the timer to cancel

Returns:

- (`true`, `false`) —
  true if the timer was successfully cancelled, or false if the timer does not exist.

Raises:

- (`ArgumentError`)

    240
    241
    242
    243
    244
    245
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 240

    def cancel_timer?(id=nil)
      if id.class == Fixnum && !block_given?
        return @j_del.java_method(:cancelTimer, [Java::long.java_class]).call(id)
      end
      raise ArgumentError, "Invalid arguments when calling cancel_timer?(id)"
    end

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

This method returns an undefined value.

Like #close but the completionHandler will be called when the close is complete

Yields:

- The handler will be notified when the close is complete.

Raises:

- (`ArgumentError`)

    259
    260
    261
    262
    263
    264
    265
    266
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 259

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

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

Is this Vert.x instance clustered?

Returns:

- (`true`, `false`) —
  true if clustered

Raises:

- (`ArgumentError`)

    307
    308
    309
    310
    311
    312
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 307

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

### - (`::Vertx::DatagramSocket`) create_datagram_socket(options = nil)

Create a datagram socket using the specified options

Parameters:

- options (`Hash`) (defaults to: `nil`) —
  the options to use

Returns:

- (`::Vertx::DatagramSocket`) —
  the socket

Raises:

- (`ArgumentError`)

    144
    145
    146
    147
    148
    149
    150
    151
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 144

    def create_datagram_socket(options=nil)
      if !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createDatagramSocket, []).call(),::Vertx::DatagramSocket)
      elsif options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createDatagramSocket, [Java::IoVertxCoreDatagram::DatagramSocketOptions.java_class]).call(Java::IoVertxCoreDatagram::DatagramSocketOptions.new(::Vertx::Util::Utils.to_json_object(options))),::Vertx::DatagramSocket)
      end
      raise ArgumentError, "Invalid arguments when calling create_datagram_socket(options)"
    end

### - (`::Vertx::DnsClient`) create_dns_client(port = nil, host = nil)

Create a DNS client to connect to a DNS server at the specified host and port

Parameters:

- port (`Fixnum`) (defaults to: `nil`) —
  the port
- host (`String`) (defaults to: `nil`) —
  the host

Returns:

- (`::Vertx::DnsClient`) —
  the DNS client

Raises:

- (`ArgumentError`)

    178
    179
    180
    181
    182
    183
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 178

    def create_dns_client(port=nil,host=nil)
      if port.class == Fixnum && host.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createDnsClient, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,host),::Vertx::DnsClient)
      end
      raise ArgumentError, "Invalid arguments when calling create_dns_client(port,host)"
    end

### - (`::Vertx::HttpClient`) create_http_client(options = nil)

Create a HTTP/HTTPS client using the specified options

Parameters:

- options (`Hash`) (defaults to: `nil`) —
  the options to use

Returns:

- (`::Vertx::HttpClient`) —
  the client

Raises:

- (`ArgumentError`)

    133
    134
    135
    136
    137
    138
    139
    140
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 133

    def create_http_client(options=nil)
      if !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createHttpClient, []).call(),::Vertx::HttpClient)
      elsif options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createHttpClient, [Java::IoVertxCoreHttp::HttpClientOptions.java_class]).call(Java::IoVertxCoreHttp::HttpClientOptions.new(::Vertx::Util::Utils.to_json_object(options))),::Vertx::HttpClient)
      end
      raise ArgumentError, "Invalid arguments when calling create_http_client(options)"
    end

### - (`::Vertx::HttpServer`) create_http_server(options = nil)

Create an HTTP/HTTPS server using the specified options

Parameters:

- options (`Hash`) (defaults to: `nil`) —
  the options to use

Returns:

- (`::Vertx::HttpServer`) —
  the server

Raises:

- (`ArgumentError`)

    122
    123
    124
    125
    126
    127
    128
    129
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 122

    def create_http_server(options=nil)
      if !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createHttpServer, []).call(),::Vertx::HttpServer)
      elsif options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createHttpServer, [Java::IoVertxCoreHttp::HttpServerOptions.java_class]).call(Java::IoVertxCoreHttp::HttpServerOptions.new(::Vertx::Util::Utils.to_json_object(options))),::Vertx::HttpServer)
      end
      raise ArgumentError, "Invalid arguments when calling create_http_server(options)"
    end

### - (`::Vertx::NetClient`) create_net_client(options = nil)

Create a TCP/SSL client using the specified options

Parameters:

- options (`Hash`) (defaults to: `nil`) —
  the options to use

Returns:

- (`::Vertx::NetClient`) —
  the client

Raises:

- (`ArgumentError`)

    111
    112
    113
    114
    115
    116
    117
    118
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 111

    def create_net_client(options=nil)
      if !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createNetClient, []).call(),::Vertx::NetClient)
      elsif options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createNetClient, [Java::IoVertxCoreNet::NetClientOptions.java_class]).call(Java::IoVertxCoreNet::NetClientOptions.new(::Vertx::Util::Utils.to_json_object(options))),::Vertx::NetClient)
      end
      raise ArgumentError, "Invalid arguments when calling create_net_client(options)"
    end

### - (`::Vertx::NetServer`) create_net_server(options = nil)

Create a TCP/SSL server using the specified options

Parameters:

- options (`Hash`) (defaults to: `nil`) —
  the options to use

Returns:

- (`::Vertx::NetServer`) —
  the server

Raises:

- (`ArgumentError`)

    100
    101
    102
    103
    104
    105
    106
    107
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 100

    def create_net_server(options=nil)
      if !block_given? && options == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createNetServer, []).call(),::Vertx::NetServer)
      elsif options.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:createNetServer, [Java::IoVertxCoreNet::NetServerOptions.java_class]).call(Java::IoVertxCoreNet::NetServerOptions.new(::Vertx::Util::Utils.to_json_object(options))),::Vertx::NetServer)
      end
      raise ArgumentError, "Invalid arguments when calling create_net_server(options)"
    end

### - (`void`) deploy_verticle(name = nil, options = nil) { ... }

This method returns an undefined value.

Like #deploy_verticle but Hash are provided to configure the deployment.

Parameters:

- name (`String`) (defaults to: `nil`) —
  the name
- options (`Hash`) (defaults to: `nil`) —
  the deployment options.

Yields:

- a handler which will be notified when the deployment is complete

Raises:

- (`ArgumentError`)

    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 273

    def deploy_verticle(name=nil,options=nil)
      if name.class == String && !block_given? && options == nil
        return @j_del.java_method(:deployVerticle, [Java::java.lang.String.java_class]).call(name)
      elsif name.class == String && block_given? && options == nil
        return @j_del.java_method(:deployVerticle, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      elsif name.class == String && options.class == Hash && !block_given?
        return @j_del.java_method(:deployVerticle, [Java::java.lang.String.java_class,Java::IoVertxCore::DeploymentOptions.java_class]).call(name,Java::IoVertxCore::DeploymentOptions.new(::Vertx::Util::Utils.to_json_object(options)))
      elsif name.class == String && options.class == Hash && block_given?
        return @j_del.java_method(:deployVerticle, [Java::java.lang.String.java_class,Java::IoVertxCore::DeploymentOptions.java_class,Java::IoVertxCore::Handler.java_class]).call(name,Java::IoVertxCore::DeploymentOptions.new(::Vertx::Util::Utils.to_json_object(options)),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling deploy_verticle(name,options)"
    end

### - (`Set<String>`) deployment_i_ds

Return a Set of deployment IDs for the currently deployed deploymentIDs.

Returns:

- (`Set<String>`) —
  Set of deployment IDs

Raises:

- (`ArgumentError`)

    299
    300
    301
    302
    303
    304
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 299

    def deployment_i_ds
      if !block_given?
        return ::Vertx::Util::Utils.to_set(@j_del.java_method(:deploymentIDs, []).call()).map! { |elt| elt }
      end
      raise ArgumentError, "Invalid arguments when calling deployment_i_ds()"
    end

### - (`::Vertx::EventBus`) event_bus

Get the event bus object. There is a single instance of EventBus per Vertx instance.

Returns:

- (`::Vertx::EventBus`) —
  the event bus object

Raises:

- (`ArgumentError`)

    165
    166
    167
    168
    169
    170
    171
    172
    173
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 165

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

### - (`void`) execute_blocking(blockingCodeHandler = nil, ordered = nil) { ... }

This method returns an undefined value.

Safely execute some blocking code.

Executes the blocking code in the handler `blockingCodeHandler` using a thread from the worker pool.

When the code is complete the handler `resultHandler` will be called with the result on the original context (e.g. on the original event loop of the caller).

A `Future` instance is passed into `blockingCodeHandler`. When the blocking code successfully completes, the handler should call the Future#complete or Future#complete method, or the Future#fail method if it failed.

Parameters:

- blockingCodeHandler (`Proc`) (defaults to: `nil`) —
  handler representing the blocking code to run
- ordered (`true`, `false`) (defaults to: `nil`) —
  if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees

Yields:

- handler that will be called when the blocking code is complete

Raises:

- (`ArgumentError`)

    327
    328
    329
    330
    331
    332
    333
    334
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 327

    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

### - (`::Vertx::FileSystem`) file_system

Get the filesystem object. There is a single instance of FileSystem per Vertx instance.

Returns:

- (`::Vertx::FileSystem`) —
  the filesystem object

Raises:

- (`ArgumentError`)

    154
    155
    156
    157
    158
    159
    160
    161
    162
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 154

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

### - (`::Vertx::Context`) get_or_create_context

Gets the current context, or creates one if there isn't one

Returns:

- (`::Vertx::Context`) —
  The current context (created if didn't exist)

Raises:

- (`ArgumentError`)

    91
    92
    93
    94
    95
    96
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 91

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

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

Whether the metrics are enabled for this measured object

Returns:

- (`true`, `false`) —
  true if the metrics are enabled

Raises:

- (`ArgumentError`)

    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 52

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

### - (`::Vertx::TimeoutStream`) periodic_stream(delay = nil)

Returns a periodic timer as a read stream. The timer will be fired every `delay` milliseconds after the has been called.

Parameters:

- delay (`Fixnum`) (defaults to: `nil`) —
  the delay in milliseconds, after which the timer will fire

Returns:

- (`::Vertx::TimeoutStream`) —
  the periodic stream

Raises:

- (`ArgumentError`)

    231
    232
    233
    234
    235
    236
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 231

    def periodic_stream(delay=nil)
      if delay.class == Fixnum && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:periodicStream, [Java::long.java_class]).call(delay),::Vertx::TimeoutStream)
      end
      raise ArgumentError, "Invalid arguments when calling periodic_stream(delay)"
    end

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

This method returns an undefined value.

Puts the handler on the event queue for the current context so it will be run asynchronously ASAP after all preceeding events have been handled.

Yields:

- - a handler representing the action to execute

Raises:

- (`ArgumentError`)

    250
    251
    252
    253
    254
    255
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 250

    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

### - (`Fixnum`) set_periodic(delay = nil) { ... }

Set a periodic timer to fire every `delay` milliseconds, at which point `handler` will be called with the id of the timer.

Parameters:

- delay (`Fixnum`) (defaults to: `nil`) —
  the delay in milliseconds, after which the timer will fire

Yields:

- the handler that will be called with the timer ID when the timer fires

Returns:

- (`Fixnum`) —
  the unique ID of the timer

Raises:

- (`ArgumentError`)

    221
    222
    223
    224
    225
    226
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 221

    def set_periodic(delay=nil)
      if delay.class == Fixnum && block_given?
        return @j_del.java_method(:setPeriodic, [Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(delay,(Proc.new { |event| yield(event) }))
      end
      raise ArgumentError, "Invalid arguments when calling set_periodic(delay)"
    end

### - (`Fixnum`) set_timer(delay = nil) { ... }

Set a one-shot timer to fire after `delay` milliseconds, at which point `handler` will be called with the id of the timer.

Parameters:

- delay (`Fixnum`) (defaults to: `nil`) —
  the delay in milliseconds, after which the timer will fire

Yields:

- the handler that will be called with the timer ID when the timer fires

Returns:

- (`Fixnum`) —
  the unique ID of the timer

Raises:

- (`ArgumentError`)

    200
    201
    202
    203
    204
    205
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 200

    def set_timer(delay=nil)
      if delay.class == Fixnum && block_given?
        return @j_del.java_method(:setTimer, [Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(delay,(Proc.new { |event| yield(event) }))
      end
      raise ArgumentError, "Invalid arguments when calling set_timer(delay)"
    end

### - (`::Vertx::SharedData`) shared_data

Get the shared data object. There is a single instance of SharedData per Vertx instance.

Returns:

- (`::Vertx::SharedData`) —
  the shared data object

Raises:

- (`ArgumentError`)

    186
    187
    188
    189
    190
    191
    192
    193
    194
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 186

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

### - (`::Vertx::TimeoutStream`) timer_stream(delay = nil)

Returns a one-shot timer as a read stream. The timer will be fired after `delay` milliseconds after the has been called.

Parameters:

- delay (`Fixnum`) (defaults to: `nil`) —
  the delay in milliseconds, after which the timer will fire

Returns:

- (`::Vertx::TimeoutStream`) —
  the timer stream

Raises:

- (`ArgumentError`)

    210
    211
    212
    213
    214
    215
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 210

    def timer_stream(delay=nil)
      if delay.class == Fixnum && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:timerStream, [Java::long.java_class]).call(delay),::Vertx::TimeoutStream)
      end
      raise ArgumentError, "Invalid arguments when calling timer_stream(delay)"
    end

### - (`void`) undeploy(deploymentID = nil) { ... }

This method returns an undefined value.

Like #undeploy(String) but the completionHandler will be notified when the undeployment is complete.

Parameters:

- deploymentID (`String`) (defaults to: `nil`) —
  the deployment ID

Yields:

- a handler which will be notified when the undeployment is complete

Raises:

- (`ArgumentError`)

    289
    290
    291
    292
    293
    294
    295
    296
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/vertx.rb', line 289

    def undeploy(deploymentID=nil)
      if deploymentID.class == String && !block_given?
        return @j_del.java_method(:undeploy, [Java::java.lang.String.java_class]).call(deploymentID)
      elsif deploymentID.class == String && block_given?
        return @j_del.java_method(:undeploy, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(deploymentID,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling undeploy(deploymentID)"
    end