Class SharedData
- java.lang.Object
-
- io.vertx.mutiny.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 Mutiny-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(io.vertx.core.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>
io.smallrye.mutiny.Uni<AsyncMap<K,V>>getAsyncMap(String name)
Get theAsyncMap
with the specified name.<K,V>
AsyncMap<K,V>getAsyncMapAndAwait(String name)
Blocking variant ofgetAsyncMap(String)
.<K,V>
voidgetAsyncMapAndForget(String name)
Variant ofgetAsyncMap(String)
that ignores the result of the operation.<K,V>
io.smallrye.mutiny.Uni<AsyncMap<K,V>>getClusterWideMap(String name)
Get the cluster wide map with the specified name.<K,V>
AsyncMap<K,V>getClusterWideMapAndAwait(String name)
Blocking variant ofgetClusterWideMap(String)
.<K,V>
voidgetClusterWideMapAndForget(String name)
Variant ofgetClusterWideMap(String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Counter>
getCounter(String name)
Get an asynchronous counter.Counter
getCounterAndAwait(String name)
Blocking variant ofgetCounter(String)
.void
getCounterAndForget(String name)
Variant ofgetCounter(String)
that ignores the result of the operation.io.vertx.core.shareddata.SharedData
getDelegate()
<K,V>
io.smallrye.mutiny.Uni<AsyncMap<K,V>>getLocalAsyncMap(String name)
Get theAsyncMap
with the specified name.<K,V>
AsyncMap<K,V>getLocalAsyncMapAndAwait(String name)
Blocking variant ofgetLocalAsyncMap(String)
.<K,V>
voidgetLocalAsyncMapAndForget(String name)
Variant ofgetLocalAsyncMap(String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Counter>
getLocalCounter(String name)
Get an asynchronous local counter.Counter
getLocalCounterAndAwait(String name)
Blocking variant ofgetLocalCounter(String)
.void
getLocalCounterAndForget(String name)
Variant ofgetLocalCounter(String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Lock>
getLocalLock(String name)
Get an asynchronous local lock with the specified name.Lock
getLocalLockAndAwait(String name)
Blocking variant ofgetLocalLock(String)
.void
getLocalLockAndForget(String name)
Variant ofgetLocalLock(String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Lock>
getLocalLockWithTimeout(String name, long timeout)
LikegetLocalLock(java.lang.String)
but specifying a timeout.Lock
getLocalLockWithTimeoutAndAwait(String name, long timeout)
Blocking variant ofgetLocalLockWithTimeout(String,long)
.void
getLocalLockWithTimeoutAndForget(String name, long timeout)
Variant ofgetLocalLockWithTimeout(String,long)
that ignores the result of the operation.<K,V>
LocalMap<K,V>getLocalMap(String name)
io.smallrye.mutiny.Uni<Lock>
getLock(String name)
Get an asynchronous lock with the specified name.Lock
getLockAndAwait(String name)
Blocking variant ofgetLock(String)
.void
getLockAndForget(String name)
Variant ofgetLock(String)
that ignores the result of the operation.io.smallrye.mutiny.Uni<Lock>
getLockWithTimeout(String name, long timeout)
LikegetLock(java.lang.String)
but specifying a timeout.Lock
getLockWithTimeoutAndAwait(String name, long timeout)
Blocking variant ofgetLockWithTimeout(String,long)
.void
getLockWithTimeoutAndForget(String name, long timeout)
Variant ofgetLockWithTimeout(String,long)
that ignores the result of the operation.int
hashCode()
static SharedData
newInstance(io.vertx.core.shareddata.SharedData arg)
String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<SharedData> __TYPE_ARG
-
-
Constructor Detail
-
SharedData
public SharedData(io.vertx.core.shareddata.SharedData delegate)
-
SharedData
public SharedData(Object delegate)
-
-
Method Detail
-
getDelegate
public io.vertx.core.shareddata.SharedData getDelegate()
-
getClusterWideMap
public <K,V> io.smallrye.mutiny.Uni<AsyncMap<K,V>> 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.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the map- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getClusterWideMapAndAwait
public <K,V> AsyncMap<K,V> getClusterWideMapAndAwait(String name)
Blocking variant ofgetClusterWideMap(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the map- Returns:
- the AsyncMap
instance produced by the operation.
-
getClusterWideMapAndForget
public <K,V> void getClusterWideMapAndForget(String name)
Variant ofgetClusterWideMap(String)
that ignores the result of the operation.This method subscribes on the result of
getClusterWideMap(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetClusterWideMap(String)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the map
-
getAsyncMap
public <K,V> io.smallrye.mutiny.Uni<AsyncMap<K,V>> 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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the map- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getAsyncMapAndAwait
public <K,V> AsyncMap<K,V> getAsyncMapAndAwait(String name)
Blocking variant ofgetAsyncMap(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the map- Returns:
- the AsyncMap
instance produced by the operation.
-
getAsyncMapAndForget
public <K,V> void getAsyncMapAndForget(String name)
Variant ofgetAsyncMap(String)
that ignores the result of the operation.This method subscribes on the result of
getAsyncMap(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetAsyncMap(String)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the map
-
getLocalAsyncMap
public <K,V> io.smallrye.mutiny.Uni<AsyncMap<K,V>> 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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the map- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getLocalAsyncMapAndAwait
public <K,V> AsyncMap<K,V> getLocalAsyncMapAndAwait(String name)
Blocking variant ofgetLocalAsyncMap(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the map- Returns:
- the AsyncMap
instance produced by the operation.
-
getLocalAsyncMapAndForget
public <K,V> void getLocalAsyncMapAndForget(String name)
Variant ofgetLocalAsyncMap(String)
that ignores the result of the operation.This method subscribes on the result of
getLocalAsyncMap(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetLocalAsyncMap(String)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the map
-
getLock
public io.smallrye.mutiny.Uni<Lock> 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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the lock- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getLockAndAwait
public Lock getLockAndAwait(String name)
Blocking variant ofgetLock(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the lock- Returns:
- the Lock instance produced by the operation.
-
getLockAndForget
public void getLockAndForget(String name)
Variant ofgetLock(String)
that ignores the result of the operation.This method subscribes on the result of
getLock(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetLock(String)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the lock
-
getLockWithTimeout
public io.smallrye.mutiny.Uni<Lock> getLockWithTimeout(String name, long timeout)
LikegetLock(java.lang.String)
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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the locktimeout
- the timeout in ms- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getLockWithTimeoutAndAwait
public Lock getLockWithTimeoutAndAwait(String name, long timeout)
Blocking variant ofgetLockWithTimeout(String,long)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the locktimeout
- the timeout in ms- Returns:
- the Lock instance produced by the operation.
-
getLockWithTimeoutAndForget
public void getLockWithTimeoutAndForget(String name, long timeout)
Variant ofgetLockWithTimeout(String,long)
that ignores the result of the operation.This method subscribes on the result of
getLockWithTimeout(String,long)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetLockWithTimeout(String,long)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the locktimeout
- the timeout in ms
-
getLocalLock
public io.smallrye.mutiny.Uni<Lock> 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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the lock- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getLocalLockAndAwait
public Lock getLocalLockAndAwait(String name)
Blocking variant ofgetLocalLock(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the lock- Returns:
- the Lock instance produced by the operation.
-
getLocalLockAndForget
public void getLocalLockAndForget(String name)
Variant ofgetLocalLock(String)
that ignores the result of the operation.This method subscribes on the result of
getLocalLock(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetLocalLock(String)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the lock
-
getLocalLockWithTimeout
public io.smallrye.mutiny.Uni<Lock> getLocalLockWithTimeout(String name, long timeout)
LikegetLocalLock(java.lang.String)
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.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the locktimeout
- the timeout in ms- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getLocalLockWithTimeoutAndAwait
public Lock getLocalLockWithTimeoutAndAwait(String name, long timeout)
Blocking variant ofgetLocalLockWithTimeout(String,long)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the locktimeout
- the timeout in ms- Returns:
- the Lock instance produced by the operation.
-
getLocalLockWithTimeoutAndForget
public void getLocalLockWithTimeoutAndForget(String name, long timeout)
Variant ofgetLocalLockWithTimeout(String,long)
that ignores the result of the operation.This method subscribes on the result of
getLocalLockWithTimeout(String,long)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetLocalLockWithTimeout(String,long)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the locktimeout
- the timeout in ms
-
getCounter
public io.smallrye.mutiny.Uni<Counter> getCounter(String name)
Get an asynchronous counter. The counter will be passed to the handler.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the counter.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getCounterAndAwait
public Counter getCounterAndAwait(String name)
Blocking variant ofgetCounter(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the counter.- Returns:
- the Counter instance produced by the operation.
-
getCounterAndForget
public void getCounterAndForget(String name)
Variant ofgetCounter(String)
that ignores the result of the operation.This method subscribes on the result of
getCounter(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetCounter(String)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the counter.
-
getLocalCounter
public io.smallrye.mutiny.Uni<Counter> getLocalCounter(String name)
Get an asynchronous local counter. The counter will be passed to the handler.Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
name
- the name of the counter.- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
getLocalCounterAndAwait
public Counter getLocalCounterAndAwait(String name)
Blocking variant ofgetLocalCounter(String)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
name
- the name of the counter.- Returns:
- the Counter instance produced by the operation.
-
getLocalCounterAndForget
public void getLocalCounterAndForget(String name)
Variant ofgetLocalCounter(String)
that ignores the result of the operation.This method subscribes on the result of
getLocalCounter(String)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromgetLocalCounter(String)
but you don't need to compose it with other operations.- Parameters:
name
- the name of the counter.
-
getLocalMap
public <K,V> LocalMap<K,V> getLocalMap(String name)
- Parameters:
name
- the name of the map- Returns:
- the msp
-
newInstance
public static SharedData newInstance(io.vertx.core.shareddata.SharedData arg)
-
-