Class: Vertx::SharedData
- Inherits:
-
Object
- Object
- Vertx::SharedData
- Defined in:
- /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb
Overview
Shared data allows you to share data safely between different parts of your application in a safe way.
Shared data provides:
- Cluster wide maps which can be accessed from any node of the cluster
- Cluster wide locks which can be used to give exclusive access to resources across the cluster
- Cluster wide counters used to maintain counts consistently across the cluster
- Local maps for sharing data safely in the same Vert.x instance
Please see the documentation for more information.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (void) get_cluster_wide_map(name = nil) { ... }
Get the cluster wide map with the specified name.
-
- (void) get_counter(name = nil) { ... }
Get a cluster wide counter.
-
- (::Vertx::LocalMap) get_local_map(name = nil)
Return a LocalMap with the specific name.
-
- (void) get_lock(name = nil) { ... }
Get a cluster wide lock with the specified name.
-
- (void) get_lock_with_timeout(name = nil, timeout = nil) { ... }
Like #get_lock but specifying a timeout.
Class Method Details
+ (Boolean) accept?(obj)
31 32 33 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 31 def @@j_api_type.accept?(obj) obj.class == SharedData end |
+ (Object) j_api_type
40 41 42 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 40 def self.j_api_type @@j_api_type end |
+ (Object) j_class
43 44 45 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 43 def self.j_class Java::IoVertxCoreShareddata::SharedData.java_class end |
+ (Object) unwrap(obj)
37 38 39 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 37 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
34 35 36 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 34 def @@j_api_type.wrap(obj) SharedData.new(obj) end |
Instance Method Details
- (void) get_cluster_wide_map(name = nil) { ... }
This method returns an undefined value.
Get the cluster wide map with the specified name. The map is accessible to all nodes in the cluster and data put into the map from any node is visible to to any other node.
51 52 53 54 55 56 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 51 def get_cluster_wide_map(name=nil) if name.class == String && block_given? return @j_del.java_method(:getClusterWideMap, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::AsyncMap, nil, nil) : nil) })) end raise ArgumentError, "Invalid arguments when calling get_cluster_wide_map(#{name})" end |
- (void) get_counter(name = nil) { ... }
This method returns an undefined value.
Get a cluster wide counter. The counter will be passed to the handler.
83 84 85 86 87 88 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 83 def get_counter(name=nil) if name.class == String && block_given? return @j_del.java_method(:getCounter, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Counter) : nil) })) end raise ArgumentError, "Invalid arguments when calling get_counter(#{name})" end |
- (::Vertx::LocalMap) get_local_map(name = nil)
Return a
LocalMap
with the specific name
.
92 93 94 95 96 97 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 92 def get_local_map(name=nil) if name.class == String && !block_given? return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getLocalMap, [Java::java.lang.String.java_class]).call(name),::Vertx::LocalMap, nil, nil) end raise ArgumentError, "Invalid arguments when calling get_local_map(#{name})" end |
- (void) get_lock(name = nil) { ... }
This method returns an undefined value.
Get a cluster wide lock with the specified name. The lock will be passed to the handler when it is available.
61 62 63 64 65 66 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 61 def get_lock(name=nil) if name.class == String && block_given? return @j_del.java_method(:getLock, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(name,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Lock) : nil) })) end raise ArgumentError, "Invalid arguments when calling get_lock(#{name})" end |
- (void) get_lock_with_timeout(name = nil, timeout = nil) { ... }
This method returns an undefined value.
Like #get_lock but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler
73 74 75 76 77 78 |
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/shared_data.rb', line 73 def get_lock_with_timeout(name=nil,timeout=nil) if name.class == String && timeout.class == Fixnum && block_given? return @j_del.java_method(:getLockWithTimeout, [Java::java.lang.String.java_class,Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(name,timeout,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::Vertx::Lock) : nil) })) end raise ArgumentError, "Invalid arguments when calling get_lock_with_timeout(#{name},#{timeout})" end |