private synchronized void addParticipant(String location) {
   List<String> participants = state.getList(State.PARTICIPANTS);
   if (!participants.contains(location)) {
     participants.add(location);
     long newRevision = revision.incrementAndGet();
     state.updateFromObject(State.PARTICIPANTS, participants, newRevision);
     sendStateToClients(state.getComponent(State.PARTICIPANTS));
   }
 }
 /** This master should take over from an earlier master. */
 public void resumeFrom(State lastKnownState, final int masterId) {
   for (Component c : lastKnownState.getComponents()) {
     updateRevision(c.getRevision());
   }
   state = lastKnownState;
   this.masterId = masterId;
   MasterTakeover takeover =
       new MasterTakeover(state.getList(State.PARTICIPANTS), getMasterInfo());
   new Thread(takeover).start();
 }
 private synchronized void removeParticipant(String url) {
   List<String> participants0 = state.getList(State.PARTICIPANTS);
   if (participants0.contains(url)) {
     logger.info("removeParticipant({})", url);
     participants0.remove(url);
     long newRevision = revision.incrementAndGet();
     state.updateFromObject(State.PARTICIPANTS, participants0, newRevision);
     sendStateToClients(state.getComponent(State.PARTICIPANTS));
   }
 }
 private void sendStateToClients(State.Component component) {
   for (String clientLocation : state.getList(com.orbekk.same.State.PARTICIPANTS)) {
     sendComponent(clientLocation, component);
   }
 }