void updateMembers(Collection<MemberInfo> lsMemberInfos) { checkServiceThread(); final Map<Address, MemberImpl> mapOldMembers = new HashMap<Address, MemberImpl>(); for (MemberImpl member : lsMembers) { mapOldMembers.put(member.getAddress(), member); } if (mapOldMembers.size() == lsMemberInfos.size()) { boolean same = true; for (MemberInfo memberInfo : lsMemberInfos) { MemberImpl member = mapOldMembers.get(memberInfo.getAddress()); if (member == null || !member.getUuid().equals(memberInfo.uuid)) { same = false; break; } } if (same) { logger.log(Level.FINEST, "No need to process member update..."); return; } } logger.log(Level.FINEST, "Updating Members"); lsMembers.clear(); dataMemberCount.reset(); mapMembers.clear(); memberMasterConfirmationTimes.clear(); for (MemberInfo memberInfo : lsMemberInfos) { MemberImpl member = mapOldMembers.get(memberInfo.address); if (member == null) { member = addMember(memberInfo.address, memberInfo.nodeType, memberInfo.uuid); } else { addMember(member); } member.didRead(); } if (!lsMembers.contains(thisMember)) { throw new RuntimeException("Member list doesn't contain local member!"); } heartBeater(); node.getClusterImpl().setMembers(lsMembers); node.setJoined(); logger.log(Level.INFO, this.toString()); }
public boolean shutdown(String server) throws RemoteException { if (server.equalsIgnoreCase(FORCE_SHUTDOWN)) { System.exit(0); return true; } else if (server.equalsIgnoreCase("middleware")) { // Shutdown the cars group. shutdownGroup(this.carGroup); // Shutdown the rooms group. shutdownGroup(this.roomGroup); // Shutdown the flights group. shutdownGroup(this.flightGroup); // Shutdown all the middleware servers except yourself. for (MemberInfo m : this.currentMembers) { if (!m.equals(this.myInfo)) { shutdownMember(m); } } // Shut yourself down. System.exit(0); return true; } else if (server.equalsIgnoreCase("cars")) { shutdownGroup(this.carGroup); return true; } else if (server.equalsIgnoreCase("rooms")) { shutdownGroup(this.roomGroup); return true; } else if (server.equalsIgnoreCase("flights")) { shutdownGroup(this.flightGroup); return true; } else { return false; } }