code: private int getPriority(BlockInfo block, 
                            int curReplicas, 
                            int decommissionedReplicas,
                            int expectedReplicas) {
      if (curReplicas<0 || curReplicas>=expectedReplicas) {
        return LEVEL; // no need to replicate
      } else if(curReplicas==0) {
        // If there are zero non-decommissioned replica but there are
        // some decommissioned replicas, then assign them highest priority
        if (decommissionedReplicas > 0) {
          return 0;
        }
        return QUEUE_WITH_CORRUPT_BLOCKS; // keep these blocks in needed replication.
      } else if(curReplicas==1) {
        return isRaidedBlock(block) ? 1 : 0; // highest priority
      } else if(curReplicas*3<expectedReplicas) {
        return 1;
      } else {
        return 2;
      }
    }
docs: /* Return the priority of a block
  
  If this is a Raided block and still has 1 replica left, not assign the highest priority.
  
  @param block a under replication block
  @param curReplicas current number of replicas of the block
  @param expectedReplicas expected number of replicas of the block