Reference Guide

Table Of Contents
}
public void writeDistributedMap(String namespace, String key, String value)
{
ObjectMapper mapper = new ObjectMapper();
Namespace mapNamespace = Namespace.valueOf(namespace);
DistributedMap<String, String> distMap =
coordinationService.getMap(mapNamespace);
if(distMap == null){
throw new RuntimeException("Can't get a Distributed Map
instance.");
}
distMap.put(key, value);
}
public void subscribeListener(String namespace) {
Namespace mapNamespace = Namespace.valueOf(namespace);
DistributedMap<String, String> distMap =
coordinationService.getMap(mapNamespace);
if(distMap == null){
throw new RuntimeException("Can't get a Distributed Map
instance.");
}
listener = new SimpleEntryListener();
if (listener == null) {
throw new RuntimeException("Can't get a SimpleEntryListener
instance.");
}
distMap.register(listener);
}
public void unSubscribeListener(String namespace) {
Namespace mapNamespace = Namespace.valueOf(namespace);
DistributedMap<String, String> distMap =
coordinationService.getMap(mapNamespace);
if(distMap == null){
throw new RuntimeException("Can't get a Distributed Map
instance.");
}
73