Class SharedData
- java.lang.Object
-
- io.vertx.reactivex.core.shareddata.SharedData
-
public class SharedData extends Object
Shared data allows you to share data safely between different parts of your application in a safe way.Shared data provides:
- synchronous shared maps (local)
- asynchronous maps (local or cluster-wide)
- asynchronous locks (local or cluster-wide)
- asynchronous counters (local or cluster-wide)
WARNING: In clustered mode, asynchronous maps/locks/counters rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous maps/locks/counters operations can be much higher in clustered than in local mode.
Please see the documentation for more information. NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<SharedData>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description SharedData(SharedData delegate)
SharedData(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
<K,V>
voidgetAsyncMap(String name)
Get theAsyncMap
with the specified name.<K,V>
voidgetAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get theAsyncMap
with the specified name.<K,V>
voidgetClusterWideMap(String name)
Get the cluster wide map with the specified name.<K,V>
voidgetClusterWideMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get the cluster wide map with the specified name.void
getCounter(String name)
Get an asynchronous counter.void
getCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
Get an asynchronous counter.SharedData
getDelegate()
<K,V>
voidgetLocalAsyncMap(String name)
Get theAsyncMap
with the specified name.<K,V>
voidgetLocalAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get theAsyncMap
with the specified name.void
getLocalCounter(String name)
Get an asynchronous local counter.void
getLocalCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
Get an asynchronous local counter.void
getLocalLock(String name)
Get an asynchronous local lock with the specified name.void
getLocalLock(String name, Handler<AsyncResult<Lock>> resultHandler)
Get an asynchronous local lock with the specified name.void
getLocalLockWithTimeout(String name, long timeout)
LikegetLocalLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout.void
getLocalLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
LikegetLocalLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout.<K,V>
LocalMap<K,V>getLocalMap(String name)
Return aLocalMap
with the specificname
.void
getLock(String name)
Get an asynchronous lock with the specified name.void
getLock(String name, Handler<AsyncResult<Lock>> resultHandler)
Get an asynchronous lock with the specified name.void
getLockWithTimeout(String name, long timeout)
LikegetLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout.void
getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
LikegetLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout.int
hashCode()
static SharedData
newInstance(SharedData arg)
<K,V>
io.reactivex.Single<AsyncMap<K,V>>rxGetAsyncMap(String name)
Get theAsyncMap
with the specified name.<K,V>
io.reactivex.Single<AsyncMap<K,V>>rxGetClusterWideMap(String name)
Get the cluster wide map with the specified name.io.reactivex.Single<Counter>
rxGetCounter(String name)
Get an asynchronous counter.<K,V>
io.reactivex.Single<AsyncMap<K,V>>rxGetLocalAsyncMap(String name)
Get theAsyncMap
with the specified name.io.reactivex.Single<Counter>
rxGetLocalCounter(String name)
Get an asynchronous local counter.io.reactivex.Single<Lock>
rxGetLocalLock(String name)
Get an asynchronous local lock with the specified name.io.reactivex.Single<Lock>
rxGetLocalLockWithTimeout(String name, long timeout)
LikegetLocalLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout.io.reactivex.Single<Lock>
rxGetLock(String name)
Get an asynchronous lock with the specified name.io.reactivex.Single<Lock>
rxGetLockWithTimeout(String name, long timeout)
LikegetLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout.String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<SharedData> __TYPE_ARG
-
-
Constructor Detail
-
SharedData
public SharedData(SharedData delegate)
-
SharedData
public SharedData(Object delegate)
-
-
Method Detail
-
getDelegate
public SharedData getDelegate()
-
getClusterWideMap
public <K,V> void getClusterWideMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
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.- Parameters:
name
- the name of the mapresultHandler
- the map will be returned asynchronously in this handler
-
getClusterWideMap
public <K,V> void getClusterWideMap(String name)
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.- Parameters:
name
- the name of the map
-
rxGetClusterWideMap
public <K,V> io.reactivex.Single<AsyncMap<K,V>> rxGetClusterWideMap(String name)
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.- Parameters:
name
- the name of the map- Returns:
-
getAsyncMap
public <K,V> void getAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get theAsyncMap
with the specified name. When clustered, 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.WARNING: In clustered mode, asynchronous shared maps rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous shared maps operations can be much higher in clustered than in local mode.
- Parameters:
name
- the name of the mapresultHandler
- the map will be returned asynchronously in this handler
-
getAsyncMap
public <K,V> void getAsyncMap(String name)
Get theAsyncMap
with the specified name. When clustered, 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.WARNING: In clustered mode, asynchronous shared maps rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous shared maps operations can be much higher in clustered than in local mode.
- Parameters:
name
- the name of the map
-
rxGetAsyncMap
public <K,V> io.reactivex.Single<AsyncMap<K,V>> rxGetAsyncMap(String name)
Get theAsyncMap
with the specified name. When clustered, 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.WARNING: In clustered mode, asynchronous shared maps rely on distributed data structures provided by the cluster manager. Beware that the latency relative to asynchronous shared maps operations can be much higher in clustered than in local mode.
- Parameters:
name
- the name of the map- Returns:
-
getLocalAsyncMap
public <K,V> void getLocalAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get theAsyncMap
with the specified name.When clustered, the map is NOT accessible to all nodes in the cluster. Only the instance which created the map can put and retrieve data from this map.
- Parameters:
name
- the name of the mapresultHandler
- the map will be returned asynchronously in this handler
-
getLocalAsyncMap
public <K,V> void getLocalAsyncMap(String name)
Get theAsyncMap
with the specified name.When clustered, the map is NOT accessible to all nodes in the cluster. Only the instance which created the map can put and retrieve data from this map.
- Parameters:
name
- the name of the map
-
rxGetLocalAsyncMap
public <K,V> io.reactivex.Single<AsyncMap<K,V>> rxGetLocalAsyncMap(String name)
Get theAsyncMap
with the specified name.When clustered, the map is NOT accessible to all nodes in the cluster. Only the instance which created the map can put and retrieve data from this map.
- Parameters:
name
- the name of the map- Returns:
-
getLock
public void getLock(String name, Handler<AsyncResult<Lock>> resultHandler)
Get an asynchronous lock with the specified name. The lock will be passed to the handler when it is available.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the lockresultHandler
- the handler
-
getLock
public void getLock(String name)
Get an asynchronous lock with the specified name. The lock will be passed to the handler when it is available.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the lock
-
rxGetLock
public io.reactivex.Single<Lock> rxGetLock(String name)
Get an asynchronous lock with the specified name. The lock will be passed to the handler when it is available.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the lock- Returns:
-
getLockWithTimeout
public void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
LikegetLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the locktimeout
- the timeout in msresultHandler
- the handler
-
getLockWithTimeout
public void getLockWithTimeout(String name, long timeout)
LikegetLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the locktimeout
- the timeout in ms
-
rxGetLockWithTimeout
public io.reactivex.Single<Lock> rxGetLockWithTimeout(String name, long timeout)
LikegetLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the locktimeout
- the timeout in ms- Returns:
-
getLocalLock
public void getLocalLock(String name, Handler<AsyncResult<Lock>> resultHandler)
Get an asynchronous local lock with the specified name. The lock will be passed to the handler when it is available.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the lockresultHandler
- the handler
-
getLocalLock
public void getLocalLock(String name)
Get an asynchronous local lock with the specified name. The lock will be passed to the handler when it is available.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the lock
-
rxGetLocalLock
public io.reactivex.Single<Lock> rxGetLocalLock(String name)
Get an asynchronous local lock with the specified name. The lock will be passed to the handler when it is available.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the lock- Returns:
-
getLocalLockWithTimeout
public void getLocalLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
LikegetLocalLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the locktimeout
- the timeout in msresultHandler
- the handler
-
getLocalLockWithTimeout
public void getLocalLockWithTimeout(String name, long timeout)
LikegetLocalLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the locktimeout
- the timeout in ms
-
rxGetLocalLockWithTimeout
public io.reactivex.Single<Lock> rxGetLocalLockWithTimeout(String name, long timeout)
LikegetLocalLock(java.lang.String, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.reactivex.core.shareddata.Lock>>)
but specifying a timeout. If the lock is not obtained within the timeout a failure will be sent to the handler.In general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
- Parameters:
name
- the name of the locktimeout
- the timeout in ms- Returns:
-
getCounter
public void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
Get an asynchronous counter. The counter will be passed to the handler.- Parameters:
name
- the name of the counter.resultHandler
- the handler
-
getCounter
public void getCounter(String name)
Get an asynchronous counter. The counter will be passed to the handler.- Parameters:
name
- the name of the counter.
-
rxGetCounter
public io.reactivex.Single<Counter> rxGetCounter(String name)
Get an asynchronous counter. The counter will be passed to the handler.- Parameters:
name
- the name of the counter.- Returns:
-
getLocalCounter
public void getLocalCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
Get an asynchronous local counter. The counter will be passed to the handler.- Parameters:
name
- the name of the counter.resultHandler
- the handler
-
getLocalCounter
public void getLocalCounter(String name)
Get an asynchronous local counter. The counter will be passed to the handler.- Parameters:
name
- the name of the counter.
-
rxGetLocalCounter
public io.reactivex.Single<Counter> rxGetLocalCounter(String name)
Get an asynchronous local counter. The counter will be passed to the handler.- Parameters:
name
- the name of the counter.- Returns:
-
getLocalMap
public <K,V> LocalMap<K,V> getLocalMap(String name)
Return aLocalMap
with the specificname
.- Parameters:
name
- the name of the map- Returns:
- the map
-
newInstance
public static SharedData newInstance(SharedData arg)
-
-