Package io.vertx.reactivex.core.shareddata

## 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 the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.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> Future<AsyncMap<K,​V>>` | `getAsyncMap​(String name)` | Get the `AsyncMap` with the specified name.
    `<K,​V> Future<AsyncMap<K,​V>>` | `getClusterWideMap​(String name)` | Get the cluster wide map with the specified name.
    `Future<Counter>` | `getCounter​(String name)` | Get an asynchronous counter.
    `SharedData` | `getDelegate()` |
    `<K,​V> Future<AsyncMap<K,​V>>` | `getLocalAsyncMap​(String name)` | Get the `AsyncMap` with the specified name.
    `Future<Counter>` | `getLocalCounter​(String name)` | Get an asynchronous local counter.
    `Future<Lock>` | `getLocalLock​(String name)` | Get an asynchronous local lock with the specified name.
    `Future<Lock>` | `getLocalLockWithTimeout​(String name, long timeout)` | Like `getLocalLock(java.lang.String)` but specifying a timeout.
    `<K,​V> LocalMap<K,​V>` | `getLocalMap​(String name)` | Return a `LocalMap` with the specific `name`.
    `Future<Lock>` | `getLock​(String name)` | Get an asynchronous lock with the specified name.
    `Future<Lock>` | `getLockWithTimeout​(String name, long timeout)` | Like `getLock(java.lang.String)` but specifying a timeout.
    `int` | `hashCode()` |
    `static SharedData` | `newInstance​(SharedData arg)` |
    `<K,​V> Single<AsyncMap<K,​V>>` | `rxGetAsyncMap​(String name)` | Get the `AsyncMap` with the specified name.
    `<K,​V> Single<AsyncMap<K,​V>>` | `rxGetClusterWideMap​(String name)` | Get the cluster wide map with the specified name.
    `Single<Counter>` | `rxGetCounter​(String name)` | Get an asynchronous counter.
    `<K,​V> Single<AsyncMap<K,​V>>` | `rxGetLocalAsyncMap​(String name)` | Get the `AsyncMap` with the specified name.
    `Single<Counter>` | `rxGetLocalCounter​(String name)` | Get an asynchronous local counter.
    `Single<Lock>` | `rxGetLocalLock​(String name)` | Get an asynchronous local lock with the specified name.
    `Single<Lock>` | `rxGetLocalLockWithTimeout​(String name, long timeout)` | Like `getLocalLock(java.lang.String)` but specifying a timeout.
    `Single<Lock>` | `rxGetLock​(String name)` | Get an asynchronous lock with the specified name.
    `Single<Lock>` | `rxGetLockWithTimeout​(String name, long timeout)` | Like `getLock(java.lang.String)` but specifying a timeout.
    `<T> Single<T>` | `rxWithLocalLock​(String name, long timeout, java.util.function.Supplier<Future<T>> block)` | Like `withLocalLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout.
    `<T> Single<T>` | `rxWithLocalLock​(String name, java.util.function.Supplier<Future<T>> block)` | Get an asynchronous local lock with the specified name.
    `<T> Single<T>` | `rxWithLock​(String name, long timeout, java.util.function.Supplier<Future<T>> block)` | Like `withLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout.
    `<T> Single<T>` | `rxWithLock​(String name, java.util.function.Supplier<Future<T>> block)` | Get an asynchronous lock with the specified name.
    `String` | `toString()` |
    `<T> Future<T>` | `withLocalLock​(String name, long timeout, java.util.function.Supplier<Future<T>> block)` | Like `withLocalLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout.
    `<T> Future<T>` | `withLocalLock​(String name, java.util.function.Supplier<Future<T>> block)` | Get an asynchronous local lock with the specified name.
    `<T> Future<T>` | `withLock​(String name, long timeout, java.util.function.Supplier<Future<T>> block)` | Like `withLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout.
    `<T> Future<T>` | `withLock​(String name, java.util.function.Supplier<Future<T>> block)` | Get an asynchronous lock with the specified name.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<SharedData> __TYPE_ARG

  - ### Constructor Detail

    - #### SharedData

          public SharedData​(SharedData delegate)

    - #### SharedData

          public SharedData​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public SharedData getDelegate()

    - #### getClusterWideMap

          public <K,​V> Future<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.
      Parameters:
        `name` - the name of the map
      Returns:
        a future notified with the map

    - #### rxGetClusterWideMap

          public <K,​V> 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:
        a future notified with the map

    - #### getAsyncMap

          public <K,​V> Future<AsyncMap<K,​V>> getAsyncMap​(String name)

      Get the `AsyncMap` 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:
        a future notified with the map

    - #### rxGetAsyncMap

          public <K,​V> Single<AsyncMap<K,​V>> rxGetAsyncMap​(String name)

      Get the `AsyncMap` 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:
        a future notified with the map

    - #### getLocalAsyncMap

          public <K,​V> Future<AsyncMap<K,​V>> getLocalAsyncMap​(String name)

      Get the `AsyncMap` 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:
        a future notified with the map

    - #### rxGetLocalAsyncMap

          public <K,​V> Single<AsyncMap<K,​V>> rxGetLocalAsyncMap​(String name)

      Get the `AsyncMap` 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:
        a future notified with the map

    - #### getLock

          public Future<Lock> getLock​(String name)

      Get an asynchronous lock with the specified name. The returned future will be completed with the lock 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:
        a future notified with the lock

    - #### rxGetLock

          public Single<Lock> rxGetLock​(String name)

      Get an asynchronous lock with the specified name. The returned future will be completed with the lock 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:
        a future notified with the lock

    - #### getLockWithTimeout

          public Future<Lock> getLockWithTimeout​(String name,
                                                 long timeout)

      Like `getLock(java.lang.String)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.

      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
        `timeout` - the timeout in ms
      Returns:
        a future notified with the lock

    - #### rxGetLockWithTimeout

          public Single<Lock> rxGetLockWithTimeout​(String name,
                                                   long timeout)

      Like `getLock(java.lang.String)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.

      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
        `timeout` - the timeout in ms
      Returns:
        a future notified with the lock

    - #### withLock

          public <T> Future<T> withLock​(String name,
                                        java.util.function.Supplier<Future<T>> block)

      Get an asynchronous lock with the specified name.

      When the `block` is called, the lock is already acquired, it will be released when the `Future` returned by the block completes.

      When the `block` fails, the lock is released and the returned future is failed with the cause of the failure.

      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
        `block` -
      Returns:
        the future returned by the `block`

    - #### rxWithLock

          public <T> Single<T> rxWithLock​(String name,
                                          java.util.function.Supplier<Future<T>> block)

      Get an asynchronous lock with the specified name.

      When the `block` is called, the lock is already acquired, it will be released when the `Future` returned by the block completes.

      When the `block` fails, the lock is released and the returned future is failed with the cause of the failure.

      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
        `block` -
      Returns:
        the future returned by the `block`

    - #### withLock

          public <T> Future<T> withLock​(String name,
                                        long timeout,
                                        java.util.function.Supplier<Future<T>> block)

      Like `withLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.
      Parameters:
        `name` - the name of the lock
        `timeout` - the timeout in ms
        `block` - the code block called after lock acquisition
      Returns:
        the future returned by the `block`

    - #### rxWithLock

          public <T> Single<T> rxWithLock​(String name,
                                          long timeout,
                                          java.util.function.Supplier<Future<T>> block)

      Like `withLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.
      Parameters:
        `name` - the name of the lock
        `timeout` - the timeout in ms
        `block` - the code block called after lock acquisition
      Returns:
        the future returned by the `block`

    - #### getLocalLock

          public Future<Lock> getLocalLock​(String name)

      Get an asynchronous local lock with the specified name. The returned future will be completed with the lock 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:
        a future notified with the lock

    - #### rxGetLocalLock

          public Single<Lock> rxGetLocalLock​(String name)

      Get an asynchronous local lock with the specified name. The returned future will be completed with the lock 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:
        a future notified with the lock

    - #### getLocalLockWithTimeout

          public Future<Lock> getLocalLockWithTimeout​(String name,
                                                      long timeout)

      Like `getLocalLock(java.lang.String)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.

      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
        `timeout` - the timeout in ms
      Returns:
        a future notified with the lock

    - #### rxGetLocalLockWithTimeout

          public Single<Lock> rxGetLocalLockWithTimeout​(String name,
                                                        long timeout)

      Like `getLocalLock(java.lang.String)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.

      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
        `timeout` - the timeout in ms
      Returns:
        a future notified with the lock

    - #### withLocalLock

          public <T> Future<T> withLocalLock​(String name,
                                             java.util.function.Supplier<Future<T>> block)

      Get an asynchronous local lock with the specified name.

      When the `block` is called, the lock is already acquired, it will be released when the `Future` returned by the block completes.

      When the `block` fails, the lock is released and the returned future is failed with the cause of the failure.

      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
        `block` -
      Returns:
        the future returned by the `block`

    - #### rxWithLocalLock

          public <T> Single<T> rxWithLocalLock​(String name,
                                               java.util.function.Supplier<Future<T>> block)

      Get an asynchronous local lock with the specified name.

      When the `block` is called, the lock is already acquired, it will be released when the `Future` returned by the block completes.

      When the `block` fails, the lock is released and the returned future is failed with the cause of the failure.

      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
        `block` -
      Returns:
        the future returned by the `block`

    - #### withLocalLock

          public <T> Future<T> withLocalLock​(String name,
                                             long timeout,
                                             java.util.function.Supplier<Future<T>> block)

      Like `withLocalLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.
      Parameters:
        `name` - the name of the lock
        `timeout` - the timeout in ms
        `block` - the code block called after lock acquisition
      Returns:
        the future returned by the `block`

    - #### rxWithLocalLock

          public <T> Single<T> rxWithLocalLock​(String name,
                                               long timeout,
                                               java.util.function.Supplier<Future<T>> block)

      Like `withLocalLock(java.lang.String, java.util.function.Supplier<io.vertx.core.Future<T>>)` but specifying a timeout. If the lock is not obtained within the timeout the returned future is failed.
      Parameters:
        `name` - the name of the lock
        `timeout` - the timeout in ms
        `block` - the code block called after lock acquisition
      Returns:
        the future returned by the `block`

    - #### getCounter

          public Future<Counter> getCounter​(String name)

      Get an asynchronous counter. The counter will be passed to the handler.
      Parameters:
        `name` - the name of the counter.
      Returns:
        a future notified with the counter

    - #### rxGetCounter

          public 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:
        a future notified with the counter

    - #### getLocalCounter

          public Future<Counter> getLocalCounter​(String name)

      Get an asynchronous local counter. The counter will be passed to the handler.
      Parameters:
        `name` - the name of the counter.
      Returns:
        a future notified with the counter

    - #### rxGetLocalCounter

          public 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:
        a future notified with the counter

    - #### getLocalMap

          public <K,​V> LocalMap<K,​V> getLocalMap​(String name)

      Return a `LocalMap` with the specific `name`.
      Parameters:
        `name` - the name of the map
      Returns:
        the map

    - #### newInstance

          public static SharedData newInstance​(SharedData arg)