code: private void updateNeededReplicationQueue(BlockInfo blockInfo, int delta,
        int numCurrentReplicas, int numCurrentDecommissionedReplicas,
         DatanodeDescriptor node, short fileReplication) {
       int numOldReplicas = numCurrentReplicas;
       int numOldDecommissionedReplicas = numCurrentDecommissionedReplicas;
       if (node.isDecommissioned() || node.isDecommissionInProgress()) {
         numOldDecommissionedReplicas -= delta;
       } else {
         numOldReplicas -= delta;
       }   
       if (fileReplication > numOldReplicas) {
         neededReplications.remove(blockInfo, numOldReplicas,
             numOldDecommissionedReplicas, fileReplication);
       }
       if (fileReplication > numCurrentReplicas) {
         neededReplications.add(blockInfo, numCurrentReplicas,
             numCurrentDecommissionedReplicas, fileReplication); 
       }   
     }
docs: Update a block's priority queue in neededReplicaiton queues
  
  @param blockInfo blockInfo
  @param delta the change of number of replicas
  @param numCurrentReplicas current number of replicas
  @param numCurrentDecommissionedReplicas current number of decommissioed replicas
  @param node the node where the replica resides
  @param fileReplication expected number of replicas