Sometimes it is desirable to share immutable data between different event loops, for example to implement a cache of data.

This class allows instances of shared data structures to be looked up and used from different event loops.

The data structures themselves will only allow certain data types to be stored into them. This shields you from worrying about any thread safety issues might occur if mutable objects were shared between event loops.

The following types can be stored in a shareddata data structure:

  • Integer
  • String
  • Float
  • Boolean
  • java.lang.ByteArray - this will be automatically copied, and the copy will be stored in the structure

Instances of this class are thread-safe.

no subtypes hierarchy

Initializer
SharedData(SharedData delegate)
Inherited Attributes
Attributes inherited from: Object
hash, string
Methods
getMapshared SharedMap<Key,Item> getMap<Key, Item>(String name)
given Key satisfies Object of Integer | String | Boolean | Float | Character | ByteArray
given Item satisfies Object of Integer | String | Boolean | Float | Character | ByteArray

Return a SharedMap with the specific name. All invocations of this method with the same value of name are guaranteed to return the same SharedMap instance.

getSetshared SharedSet<Element> getSet<Element>(String name)
given Element satisfies Object of Integer | String | Boolean | Float | Character | ByteArray

Return a SharedSet with the specific name. All invocations of this method with the same value of name are guaranteed to return the same SharedSet instance.

removeMapshared Boolean removeMap(String name)

Remove the map with the specific name.

removeSetshared Boolean removeSet(String name)

Remove the set with the specific name.

Inherited Methods
Methods inherited from: Object
equals