diff options
Diffstat (limited to 'same/src/main/java/com/orbekk')
-rw-r--r-- | same/src/main/java/com/orbekk/same/MasterServiceImpl.java | 6 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/State.java | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java index d7a9e53..a8acc52 100644 --- a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java +++ b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java @@ -31,7 +31,7 @@ public class MasterServiceImpl implements MasterService, UrlReceiver, Runnable { _fullStateReceivers.add(clientUrl); synchronized(this) { state.updateFromObject(".participants", participants, - state.getRevision(".participants")); + state.getRevision(".participants") + 1); notifyAll(); } } else { @@ -79,7 +79,7 @@ public class MasterServiceImpl implements MasterService, UrlReceiver, Runnable { @Override public synchronized boolean updateStateRequest(String component, String newData, long revision) { - boolean updated = state.update(component, newData, revision); + boolean updated = state.update(component, newData, revision + 1); if (updated) { notifyAll(); } @@ -90,7 +90,7 @@ public class MasterServiceImpl implements MasterService, UrlReceiver, Runnable { public void setUrl(String url) { String myUrl = url + "MasterService.json"; logger.info("Master URL is " + myUrl); - state.update(".masterUrl", myUrl, 0); + state.update(".masterUrl", myUrl, 1); } boolean _performWork() { diff --git a/same/src/main/java/com/orbekk/same/State.java b/same/src/main/java/com/orbekk/same/State.java index c352990..19b67e5 100644 --- a/same/src/main/java/com/orbekk/same/State.java +++ b/same/src/main/java/com/orbekk/same/State.java @@ -26,8 +26,8 @@ public class State { private Set<String> updatedComponents = new TreeSet<String>(); public State(String networkName) { - update(".networkName", networkName, 0); - updateFromObject(".participants", new ArrayList<String>(), 0); + update(".networkName", networkName, 1); + updateFromObject(".participants", new ArrayList<String>(), 1); } public synchronized void clear() { @@ -54,10 +54,10 @@ public class State { component = state.get(componentName); } - if (revision >= component.getRevision()) { + if (revision > component.getRevision()) { Component oldComponent = new Component(component); component.setName(componentName); - component.setRevision(revision + 1); + component.setRevision(revision); component.setData(data); state.put(componentName, component); updatedComponents.add(componentName); |