Package com.smartfoxserver.cluster.data
Interface IGlobals
-
public interface IGlobalsGlobals, are cluster-wide global values that are kept in synch between the Lobby and all Game Nodes
They can be initialized from the main Lobby's Extension init() method and/or updated at a later time.Globals are stored as a Map of Serializable values indexed by String keys. They are meant to provide cluster-wide settings or application state, but they are not meant for real-time updates, meaning that very frequent updates are not allowed (i.e. frequency < 1sec).
NOTE: the update mechanism works only when setting calling the set() method from the Lobby side.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.io.Serializable>get()Get all Global values as a Map of Serializable valuesjava.io.Serializableget(java.lang.String key)Get a specific global value by its keyvoidset(java.util.Map<java.lang.String,java.io.Serializable> data)Update the content of all Global values and synchronize all other Nodes NOTE: the update mechanism works exclusively from the Lobby Node
-
-
-
Method Detail
-
get
java.util.Map<java.lang.String,java.io.Serializable> get()
Get all Global values as a Map of Serializable values- Returns:
- the Map of global values
-
get
java.io.Serializable get(java.lang.String key)
Get a specific global value by its key- Parameters:
key- the key name- Returns:
- the associated value, if any. Null otherwise
-
set
void set(java.util.Map<java.lang.String,java.io.Serializable> data)
Update the content of all Global values and synchronize all other Nodes NOTE: the update mechanism works exclusively from the Lobby Node- Parameters:
data- a Map with global values
-
-