Class: Vertx::WorkerExecutor
- Inherits:
-
Object
- Object
- Vertx::WorkerExecutor
- Includes:
- Measured
- Defined in:
- /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/worker_executor.rb
Overview
Instance Method Summary (collapse)
-
- (void) close
Close the executor.
-
- (void) execute_blocking(blockingCodeHandler = nil, ordered = nil) { ... }
Safely execute some blocking code.
-
- (true, false) metrics_enabled?
Whether the metrics are enabled for this measured object.
Instance Method Details
- (void) close
This method returns an undefined value.
Close the executor.
57 58 59 60 61 62 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/worker_executor.rb', line 57 def close if !block_given? return @j_del.java_method(:close, []).call() end raise ArgumentError, "Invalid arguments when calling close()" 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.
In the blockingCodeHandler
the current context remains the original context and therefore any task
scheduled in the blockingCodeHandler
will be executed on the this context and not on the worker thread.
47 48 49 50 51 52 53 54 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/worker_executor.rb', line 47 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 |
- (true, false) metrics_enabled?
24 25 26 27 28 29 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/worker_executor.rb', line 24 def metrics_enabled? if !block_given? return @j_del.java_method(:isMetricsEnabled, []).call() end raise ArgumentError, "Invalid arguments when calling metrics_enabled?()" end |