Module: Vertx
- Defined in:
- src/main/api_shim/core/timers.rb,
src/main/api_shim/core/net.rb,
src/main/api_shim/container.rb,
src/main/api_shim/core/http.rb,
src/main/api_shim/core/buffer.rb,
src/main/api_shim/core/streams.rb,
src/main/api_shim/core/sock_js.rb,
src/main/api_shim/core/event_bus.rb,
src/main/api_shim/core/parsetools.rb,
src/main/api_shim/core/tcp_support.rb,
src/main/api_shim/core/shared_data.rb,
src/main/api_shim/core/ssl_support.rb,
src/main/api_shim/core/file_system.rb,
src/main/api_shim/core/wrapped_handler.rb
Overview
Copyright 2011-2012 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Defined Under Namespace
Modules: ClientSSLSupport, ReadStream, SSLSupport, ServerSSLSupport, ServerTCPSupport, TCPSupport, WriteStream Classes: AsyncFile, Buffer, Context, EventBus, FSProps, FileProps, FileSystem, HttpClient, HttpClientRequest, HttpClientResponse, HttpServer, HttpServerFileUpload, HttpServerRequest, HttpServerResponse, Message, MultiMap, NetClient, NetServer, NetSocket, Pump, RecordParser, RouteMatcher, ServerWebSocket, SharedData, SockJSServer, SockJSSocket, WebSocket
Constant Summary
- @@j_vertx =
org.vertx.java.platform.impl.JRubyVerticleFactory.vertx()
Class Method Summary (collapse)
-
+ (Boolean) cancel_timer(id)
Cancels a timer.
-
+ (Hash) config
Get config for the verticle.
-
+ (Object) current_context
Get a reference to the current context.
-
+ (Object) deploy_module(module_name, config = nil, instances = 1, &block)
Deploy a module.
-
+ (Object) deploy_verticle(main, config = nil, instances = 1, &block)
Deploy a verticle.
-
+ (Object) deploy_worker_verticle(main, config = nil, instances = 1, multi_threaded = false, &block)
Deploy a worker verticle.
-
+ (Hash) env
Get the environment for the verticle.
-
+ (Object) exit
Cause the container to exit.
-
+ (Logger) logger
Get the logger for the verticle.
-
+ (Object) run_on_context(proc = nil, &hndlr)
Put the handler on the event queue for this loop so it will be run asynchronously ASAP after this event has been processed.
-
+ (FixNum) set_periodic(delay, proc = nil, &hndlr)
Sets a periodic timer.
-
+ (FixNum) set_timer(delay, proc = nil, &hndlr)
Sets a one-shot timer that will fire after a certain delay.
-
+ (Object) undeploy_module(id, &block)
Undeploy a module as the first parameter if undeploy failed.
-
+ (Object) undeploy_verticle(id, &block)
Undeploy a verticle as the first parameter if undeploy failed.
Class Method Details
+ (Boolean) cancel_timer(id)
Cancels a timer.
44 45 46 |
# File 'src/main/api_shim/core/timers.rb', line 44 def Vertx.cancel_timer(id) @@j_vertx.cancelTimer(id) end |
+ (Hash) config
Get config for the verticle
99 100 101 102 103 104 105 |
# File 'src/main/api_shim/container.rb', line 99 def Vertx.config if !defined? @@j_conf @@j_conf = org.vertx.java.platform.impl.JRubyVerticleFactory.container.config @@j_conf = JSON.parse(@@j_conf.encode) if @@j_conf end @@j_conf end |
+ (Object) current_context
Get a reference to the current context
58 59 60 |
# File 'src/main/api_shim/core/timers.rb', line 58 def Vertx.current_context Context.new(@@j_vertx.currentContext()) end |
+ (Object) deploy_module(module_name, config = nil, instances = 1, &block)
Deploy a module. The actual deploy happens asynchronously
the block will be an exception or nil if no failure occurred, the second parameter will be the deployment id
59 60 61 62 63 64 65 66 67 68 |
# File 'src/main/api_shim/container.rb', line 59 def Vertx.deploy_module(module_name, config = nil, instances = 1, &block) if config json_str = JSON.generate(config) config = org.vertx.java.core.json.JsonObject.new(json_str) end if block block = ARWrappedHandler.new(block) end org.vertx.java.platform.impl.JRubyVerticleFactory.container.deployModule(module_name, config, instances, block) end |
+ (Object) deploy_verticle(main, config = nil, instances = 1, &block)
Deploy a verticle. The actual deploy happens asynchronously
the block will be an exception or nil if no failure occurred, the second parameter will be the deployment id
25 26 27 28 29 30 31 32 33 34 |
# File 'src/main/api_shim/container.rb', line 25 def Vertx.deploy_verticle(main, config = nil, instances = 1, &block) if config json_str = JSON.generate(config) config = org.vertx.java.core.json.JsonObject.new(json_str) end if block block = ARWrappedHandler.new(block) end org.vertx.java.platform.impl.JRubyVerticleFactory.container.deployVerticle(main, config, instances, block) end |
+ (Object) deploy_worker_verticle(main, config = nil, instances = 1, multi_threaded = false, &block)
Deploy a worker verticle. The actual deploy happens asynchronously
the block will be an exception or nil if no failure occurred, the second parameter will be the deployment id
42 43 44 45 46 47 48 49 50 51 |
# File 'src/main/api_shim/container.rb', line 42 def Vertx.deploy_worker_verticle(main, config = nil, instances = 1, multi_threaded = false, &block) if config json_str = JSON.generate(config) config = org.vertx.java.core.json.JsonObject.new(json_str) end if block block = ARWrappedHandler.new(block) end org.vertx.java.platform.impl.JRubyVerticleFactory.container.deployWorkerVerticle(main, config, instances, multi_threaded, block) end |
+ (Hash) env
Get the environment for the verticle
108 109 110 |
# File 'src/main/api_shim/container.rb', line 108 def Vertx.env org.vertx.java.platform.impl.JRubyVerticleFactory.container.env end |
+ (Object) exit
Cause the container to exit
93 94 95 |
# File 'src/main/api_shim/container.rb', line 93 def Vertx.exit org.vertx.java.platform.impl.JRubyVerticleFactory.container.exit end |
+ (Logger) logger
Get the logger for the verticle
113 114 115 |
# File 'src/main/api_shim/container.rb', line 113 def Vertx.logger org.vertx.java.platform.impl.JRubyVerticleFactory.container.logger end |
+ (Object) run_on_context(proc = nil, &hndlr)
Put the handler on the event queue for this loop so it will be run asynchronously
ASAP after this event has been processed
52 53 54 55 |
# File 'src/main/api_shim/core/timers.rb', line 52 def Vertx.run_on_context(proc = nil, &hndlr) hndlr = proc if proc @@j_vertx.runOnContext(hndlr) end |
+ (FixNum) set_periodic(delay, proc = nil, &hndlr)
Sets a periodic timer.
This method will accept either a Proc or a block.
36 37 38 39 |
# File 'src/main/api_shim/core/timers.rb', line 36 def Vertx.set_periodic(delay, proc = nil, &hndlr) hndlr = proc if proc @@j_vertx.setPeriodic(delay, hndlr) end |
+ (FixNum) set_timer(delay, proc = nil, &hndlr)
Sets a one-shot timer that will fire after a certain delay.
This method will accept either a Proc or a block.
25 26 27 28 |
# File 'src/main/api_shim/core/timers.rb', line 25 def Vertx.set_timer(delay, proc = nil, &hndlr) hndlr = proc if proc @@j_vertx.setTimer(delay, hndlr) end |
+ (Object) undeploy_module(id, &block)
Undeploy a module
as the first parameter if undeploy failed
85 86 87 88 89 90 |
# File 'src/main/api_shim/container.rb', line 85 def Vertx.undeploy_module(id, &block) if block block = ARWrappedHandler.new(block) end org.vertx.java.platform.impl.JRubyVerticleFactory.container.undeployModule(id, block) end |
+ (Object) undeploy_verticle(id, &block)
Undeploy a verticle
as the first parameter if undeploy failed
74 75 76 77 78 79 |
# File 'src/main/api_shim/container.rb', line 74 def Vertx.undeploy_verticle(id, &block) if block block = ARWrappedHandler.new(block) end org.vertx.java.platform.impl.JRubyVerticleFactory.container.undeployVerticle(id, block) end |