- Map<String, Property> propMap = getNodeProps(node);
- if (propMap != null) {
- propMap.remove(propName);
- this.nodeProps.put(node, propMap);
+ for (int i = 0; i <= REPLACE_RETRY; i++) {
+ Map<String, Property> propMapCurr = getNodeProps(node);
+ if (propMapCurr != null) {
+ if (!propMapCurr.containsKey(propName)) {
+ return new Status(StatusCode.SUCCESS);
+ }
+ Map<String, Property> propMap = new HashMap<String, Property>();
+ for (String s : propMapCurr.keySet()) {
+ propMap.put(s, propMapCurr.get(s).clone());
+ }
+
+ propMap.remove(propName);
+ if (nodeProps.replace(node, propMapCurr, propMap)) {
+ return new Status(StatusCode.SUCCESS);
+ }
+ if (!propMapCurr.get(propName).equals(nodeProps.get(node).get(propName))) {
+ String msg = "Cluster conflict: Unable to remove property " + propName + " for node "
+ + node.getID();
+ return new Status(StatusCode.CONFLICT, msg);
+ }
+
+ } else {
+ return new Status(StatusCode.SUCCESS);
+ }