diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 20:53:36 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 20:53:36 +0100 |
commit | 7a05213bc091688d5330212e9c785005ccb147b5 (patch) | |
tree | 7f70ccb0346894146a782be95ca5d847f48af426 | |
parent | cc712c76ad04b38380028bf1c1abbe31d01c2249 (diff) |
Change joinNetworkRequest.
Remove networkName parameter to reduce the necessary information to join
a network.
-rw-r--r-- | same/src/main/java/com/orbekk/same/MasterService.java | 2 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/MasterServiceImpl.java | 28 |
2 files changed, 12 insertions, 18 deletions
diff --git a/same/src/main/java/com/orbekk/same/MasterService.java b/same/src/main/java/com/orbekk/same/MasterService.java index f1ef24a..46e8ec1 100644 --- a/same/src/main/java/com/orbekk/same/MasterService.java +++ b/same/src/main/java/com/orbekk/same/MasterService.java @@ -1,6 +1,6 @@ package com.orbekk.same; public interface MasterService { - void joinNetworkRequest(String networkName, String clientUrl); + void joinNetworkRequest(String clientUrl); boolean updateStateRequest(String component, String newData, long revision); } diff --git a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java index 6779702..410def8 100644 --- a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java +++ b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java @@ -23,24 +23,18 @@ public class MasterServiceImpl implements MasterService, UrlReceiver, Runnable { } @Override - public void joinNetworkRequest(String networkName, String clientUrl) { - if (networkName.equals(state.getDataOf(".networkName"))) { - List<String> participants = participants(); - if (!participants.contains(clientUrl)) { - participants.add(clientUrl); - synchronized(this) { - notifyAll(); - state.updateFromObject(".participants", participants, - state.getRevision(".participants")); - } - } else { - logger.warn("Client {} already part of network. " + - "Ignoring participation request", clientUrl); + public void joinNetworkRequest(String clientUrl) { + List<String> participants = participants(); + if (!participants.contains(clientUrl)) { + participants.add(clientUrl); + synchronized(this) { + notifyAll(); + state.updateFromObject(".participants", participants, + state.getRevision(".participants")); } - } else { - logger.warn("Client {} tried to join {}, but network name is {}", - new Object[]{ clientUrl, networkName, - state.getDataOf(".networkName") }); + } else { + logger.warn("Client {} already part of network. " + + "Ignoring participation request", clientUrl); } } |