/** Returns the second-in-line */ protected Address determineNextCoordinator() { synchronized(members) { return members.size() > 1? members.elementAt(1) : null; } }
/** Checks whether the potential_new_coord would be the new coordinator (2nd in line) */ protected boolean wouldBeNewCoordinator(Address potential_new_coord) { if(potential_new_coord == null) return false; synchronized(members) { if(members.size() < 2) return false; Address new_coord=members.elementAt(1); // member at 2nd place return Objects.equals(new_coord, potential_new_coord); } }
@ManagedAttribute public int getNumMembers() {return members.size();} public long getJoinTimeout() {return join_timeout;}
protected Address determineCoordinator() { synchronized(members) { return members.size() > 0? members.elementAt(0) : null; } }
public int getNumMembers() {return members != null? members.size() : 0;} public long getJoinTimeout() {return join_timeout;}
/** Checks whether the potential_new_coord would be the new coordinator (2nd in line) */ protected boolean wouldBeNewCoordinator(Address potential_new_coord) { Address new_coord; if(potential_new_coord == null) return false; synchronized(members) { if(members.size() < 2) return false; new_coord=(Address)members.elementAt(1); // member at 2nd place return new_coord != null && new_coord.equals(potential_new_coord); } }
protected Address determineCoordinator() { synchronized(members) { return members != null && members.size() > 0? (Address)members.elementAt(0) : null; } }
protected Address determineCoordinator() { synchronized(members) { return members.size() > 0? members.elementAt(0) : null; } }
/** Returns the second-in-line */ protected Address determineNextCoordinator() { synchronized(members) { return members.size() > 1? members.elementAt(1) : null; } }
/** Checks whether the potential_new_coord would be the new coordinator (2nd in line) */ protected boolean wouldBeNewCoordinator(Address potential_new_coord) { if(potential_new_coord == null) return false; synchronized(members) { if(members.size() < 2) return false; Address new_coord=members.elementAt(1); // member at 2nd place return Objects.equals(new_coord, potential_new_coord); } }
@ManagedAttribute public int getNumMembers() {return members.size();} public long getJoinTimeout() {return join_timeout;}
/** Returns potential coordinator based on lexicographic ordering of member addresses. Another approach would be to keep track of the primary partition and return the first member if we are the primary partition. */ protected boolean iWouldBeCoordinator(Vector new_mbrs) { Membership tmp_mbrs=gms.members.copy(); tmp_mbrs.merge(new_mbrs, null); tmp_mbrs.sort(); return !(tmp_mbrs.size() <= 0 || gms.local_addr == null) && gms.local_addr.equals(tmp_mbrs.elementAt(0)); }
num_mbrs=new_mbrs.size(); new_coord=num_mbrs > 0? (Address)new_mbrs.elementAt(0) : null; if(new_coord == null) {