public class SharedData
extends java.lang.Object
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:
StringIntegerLongDoubleFloatShortByteCharacterbyte[]- this will be automatically copied, and the copy will be stored in the structure.Buffer- this will be automatically copied, and the copy will be stored in the structure.
Instances of this class are thread-safe.
| Constructor and Description |
|---|
SharedData() |
| Modifier and Type | Method and Description |
|---|---|
<K,V> ConcurrentSharedMap<K,V> |
getMap(java.lang.String name)
Return a
Map with the specific name. |
<E> java.util.Set<E> |
getSet(java.lang.String name)
Return a
Set with the specific name. |
boolean |
removeMap(java.lang.Object name)
Remove the
Map with the specific name. |
boolean |
removeSet(java.lang.Object name)
Remove the
Set with the specific name. |
public <K,V> ConcurrentSharedMap<K,V> getMap(java.lang.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. public <E> java.util.Set<E> getSet(java.lang.String name)
Set with the specific name. All invocations of this method with the same value of name
are guaranteed to return the same Set instance. public boolean removeMap(java.lang.Object name)
Map with the specific name.public boolean removeSet(java.lang.Object name)
Set with the specific name.