Reference Guide

Table Of Contents
protected volatile TeamingService teamingSvc;
@Activate
protected void activate() {
coordinationService = teamingSvc.getCoordinationService();
}
public void createDistributedMap(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.");
}
}
public void deleteDistributedMap(String namespace) {
Namespace mapNamespace = Namespace.valueOf(namespace);
DistributedMap<String, String> distMap =
coordinationService.getMap(mapNamespace);
if(distMap == null) {
throw new NullPointerException();
}
distMap.clear();
}
public void readDistributedMap(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.");
}
for ( Entry<String, String> entry : distMap.entrySet()) {
String stringKey = "key " + entry.getKey().toString();
System.out.println(stringKey);
String stringValue = "value " + entry.getValue().toString();
}
72