diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-18 10:53:03 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-18 10:53:03 +0100 |
commit | 52ad0bdcd80b01ab6b40ddc0fca8c1e3ab9d0a00 (patch) | |
tree | 92871e86031e2b4ab805ef8dd9aad39b43b6832b /same/src/main | |
parent | e9773489eb1bc3f13d7b1619e03a33039937fb0a (diff) |
Remove clients upon errors.
Add test for removing clients.
Diffstat (limited to 'same/src/main')
-rw-r--r-- | same/src/main/java/com/orbekk/same/MasterServiceImpl.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java index f8044e4..ced0dba 100644 --- a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java +++ b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java @@ -68,7 +68,14 @@ public class MasterServiceImpl implements MasterService, UrlReceiver, Runnable { } private synchronized void removeParticipant(String url) { - logger.error("Remove participant {}: Operation not supported", url); + List<String> participants = participants(); + if (participants.contains(url)) { + logger.warn("RemoveParticipant({})", url); + participants.remove(url); + state.updateFromObject(".participants", participants, + state.getRevision(".participants") + 1); + notifyAll(); + } } private void broadcastNewComponents(List<String> destinations, @@ -82,7 +89,7 @@ public class MasterServiceImpl implements MasterService, UrlReceiver, Runnable { c.getRevision()); } } catch (Exception e) { - logger.warn("Client {} failed to receive state update."); + logger.info("Client {} failed to receive state update.", url); removeParticipant(url); } } |