protected Address determinePingDest() { if(pingable_mbrs == null || local_addr == null) return null; Address next=Util.pickNext(pingable_mbrs, local_addr); return Objects.equals(local_addr, next) ? null : next; }
protected void handleView(View view) { view_size=view.size(); Address tmp=Util.pickNext(view.getMembers(), local_addr); if(tmp != null && !tmp.equals(local_addr)) { next=tmp; if(log.isDebugEnabled()) log.debug("next=" + next); } }
protected void handleView(View view) { this.view=view; if(log.isDebugEnabled()) log.debug("view=" + view); List<Address> members=view.getMembers(); Address old_coord=coord; if(!members.isEmpty()) coord=members.get(0); if(Objects.equals(coord, local_addr)) { List<Address> old_backups=backup_coords != null? new ArrayList<>(backup_coords) : null; backup_coords=new CopyOnWriteArrayList<>(Util.pickNext(members, local_addr, num_backups)); // send the current values to all *new* backups List<Address> new_backups=Util.newElements(old_backups,backup_coords); for(Address new_backup: new_backups) { for(Map.Entry<String,VersionedValue> entry: counters.entrySet()) { UpdateRequest update=new UpdateRequest(entry.getKey(), entry.getValue().value, entry.getValue().version); sendRequest(new_backup, update); } } } else backup_coords=null; if(old_coord != null && coord != null && !old_coord.equals(coord) && local_addr.equals(coord)) { discard_requests=true; // set to false when the task is done startReconciliationTask(); } }
public void handleView(View view) { super.handleView(view); Address old_coord=coord; if(view.size() > 0) { coord=view.getCoord(); is_coord=coord.equals(local_addr); log.debug("[%s] coord=%s, is_coord=%b", local_addr, coord, is_coord); } if(is_coord && num_backups > 0) { List<Address> new_backups=Util.pickNext(view.getMembers(), local_addr, num_backups); List<Address> copy_locks_list=null; synchronized(backups) { if(!backups.equals(new_backups)) { copy_locks_list=new ArrayList<>(new_backups); copy_locks_list.removeAll(backups); backups.clear(); backups.addAll(new_backups); } } if(copy_locks_list != null && !copy_locks_list.isEmpty()) copyLocksTo(copy_locks_list); } // For all non-acquired client locks, send the GRANT_LOCK request to the new coordinator (if changed) if(old_coord != null && !old_coord.equals(coord)) client_lock_table.resendPendingLockRequests(); }
protected Address determinePingDest() { if(pingable_mbrs == null || local_addr == null) return null; Address next=Util.pickNext(pingable_mbrs, local_addr); return Objects.equals(local_addr, next) ? null : next; }
protected void handleView(View view) { this.view=view; if(log.isDebugEnabled()) log.debug("view=" + view); List<Address> members=view.getMembers(); Address old_coord=coord; if(!members.isEmpty()) coord=members.get(0); if(Objects.equals(coord, local_addr)) { List<Address> old_backups=backup_coords != null? new ArrayList<>(backup_coords) : null; backup_coords=new CopyOnWriteArrayList<>(Util.pickNext(members, local_addr, num_backups)); // send the current values to all *new* backups List<Address> new_backups=Util.newElements(old_backups,backup_coords); for(Address new_backup: new_backups) { for(Map.Entry<String,VersionedValue> entry: counters.entrySet()) { UpdateRequest update=new UpdateRequest(entry.getKey(), entry.getValue().value, entry.getValue().version); sendRequest(new_backup, update); } } } else backup_coords=null; if(old_coord != null && coord != null && !old_coord.equals(coord) && local_addr.equals(coord)) { discard_requests=true; // set to false when the task is done startReconciliationTask(); } }
protected void handleView(View view) { view_size=view.size(); Address tmp=Util.pickNext(view.getMembers(), local_addr); if(tmp != null && !tmp.equals(local_addr)) { next=tmp; if(log.isDebugEnabled()) log.debug("next=" + next); } }
public void handleView(View view) { super.handleView(view); Address old_coord=coord; if(view.size() > 0) { coord=view.getCoord(); is_coord=coord.equals(local_addr); log.debug("[%s] coord=%s, is_coord=%b", local_addr, coord, is_coord); } if(is_coord && num_backups > 0) { List<Address> new_backups=Util.pickNext(view.getMembers(), local_addr, num_backups); List<Address> copy_locks_list=null; synchronized(backups) { if(!backups.equals(new_backups)) { copy_locks_list=new ArrayList<>(new_backups); copy_locks_list.removeAll(backups); backups.clear(); backups.addAll(new_backups); } } if(copy_locks_list != null && !copy_locks_list.isEmpty()) copyLocksTo(copy_locks_list); } // For all non-acquired client locks, send the GRANT_LOCK request to the new coordinator (if changed) if(old_coord != null && !old_coord.equals(coord)) client_lock_table.resendPendingLockRequests(); }