public class SharedDataImpl extends Object implements SharedData
| Modifier and Type | Class and Description |
|---|---|
static class |
SharedDataImpl.WrappedAsyncMap<K,V> |
| Constructor and Description |
|---|
SharedDataImpl(VertxInternal vertx,
ClusterManager clusterManager) |
| Modifier and Type | Method and Description |
|---|---|
<K,V> void |
getAsyncMap(String name,
Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get the
AsyncMap with the specified name. |
<K,V> void |
getClusterWideMap(String name,
Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get the cluster wide map with the specified name.
|
void |
getCounter(String name,
Handler<AsyncResult<Counter>> resultHandler)
Get an asynchronous counter.
|
<K,V> void |
getLocalAsyncMap(String name,
Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
Get the
AsyncMap with the specified name. |
void |
getLocalCounter(String name,
Handler<AsyncResult<Counter>> resultHandler)
Get an asynchronous local counter.
|
void |
getLocalLock(String name,
Handler<AsyncResult<Lock>> resultHandler)
Get an asynchronous local lock with the specified name.
|
void |
getLocalLockWithTimeout(String name,
long timeout,
Handler<AsyncResult<Lock>> resultHandler)
Like
SharedData.getLocalLock(String, Handler) but specifying a timeout. |
<K,V> LocalMap<K,V> |
getLocalMap(String name)
Return a
Map with the specific name. |
void |
getLock(String name,
Handler<AsyncResult<Lock>> resultHandler)
Get an asynchronous lock with the specified name.
|
void |
getLockWithTimeout(String name,
long timeout,
Handler<AsyncResult<Lock>> resultHandler)
Like
SharedData.getLock(String, Handler) but specifying a timeout. |
public SharedDataImpl(VertxInternal vertx, ClusterManager clusterManager)
public <K,V> void getClusterWideMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
SharedDatagetClusterWideMap in interface SharedDataname - the name of the mapresultHandler - the map will be returned asynchronously in this handlerpublic <K,V> void getAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
SharedDataAsyncMap 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.
getAsyncMap in interface SharedDataname - the name of the mapresultHandler - the map will be returned asynchronously in this handlerpublic void getLock(String name, Handler<AsyncResult<Lock>> resultHandler)
SharedDataIn general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
getLock in interface SharedDataname - the name of the lockresultHandler - the handlerpublic void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
SharedDataSharedData.getLock(String, Handler) 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.
getLockWithTimeout in interface SharedDataname - the name of the locktimeout - the timeout in msresultHandler - the handlerpublic void getLocalLock(String name, Handler<AsyncResult<Lock>> resultHandler)
SharedDataIn general lock acquision is unordered, so that sequential attempts to acquire a lock, even from a single thread, can happen in non-sequential order.
getLocalLock in interface SharedDataname - the name of the lockresultHandler - the handlerpublic void getLocalLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler)
SharedDataSharedData.getLocalLock(String, Handler) 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.
getLocalLockWithTimeout in interface SharedDataname - the name of the locktimeout - the timeout in msresultHandler - the handlerpublic void getCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
SharedDatagetCounter in interface SharedDataname - the name of the counter.resultHandler - the handlerpublic <K,V> LocalMap<K,V> getLocalMap(String name)
Map with the specific name. All invocations of this method with the same value of name
are guaranteed to return the same Map instance. getLocalMap in interface SharedDataname - the name of the mappublic <K,V> void getLocalAsyncMap(String name, Handler<AsyncResult<AsyncMap<K,V>>> resultHandler)
SharedDataAsyncMap 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.
getLocalAsyncMap in interface SharedDataname - the name of the mapresultHandler - the map will be returned asynchronously in this handlerpublic void getLocalCounter(String name, Handler<AsyncResult<Counter>> resultHandler)
SharedDatagetLocalCounter in interface SharedDataname - the name of the counter.resultHandler - the handlerCopyright © 2020. All rights reserved.