Example #1
0
 /** Decrease the count of running tasks of a certain task runner */
 private synchronized void decreaseConcurrency(int volumeId) {
   if (diskVolumeLoads.containsKey(volumeId)) {
     Integer concurrency = diskVolumeLoads.get(volumeId);
     if (concurrency > 0) {
       diskVolumeLoads.put(volumeId, concurrency - 1);
     } else {
       if (volumeId > REMOTE && !unassignedTaskForEachVolume.containsKey(volumeId)) {
         diskVolumeLoads.remove(volumeId);
       }
     }
   }
 }
Example #2
0
    /**
     * Increase the count of running tasks and disk loads for a certain task runner.
     *
     * @param volumeId Volume identifier
     * @return the volume load (i.e., how many running tasks use this volume)
     */
    private synchronized int increaseConcurrency(int volumeId) {

      int concurrency = 1;
      if (diskVolumeLoads.containsKey(volumeId)) {
        concurrency = diskVolumeLoads.get(volumeId) + 1;
      }

      if (volumeId > -1) {
        LOG.info(
            "Assigned host : "
                + host
                + ", Volume : "
                + volumeId
                + ", Concurrency : "
                + concurrency);
      } else if (volumeId == -1) {
        // this case is disabled namenode block meta or compressed text file or amazon s3
        LOG.info(
            "Assigned host : "
                + host
                + ", Unknown Volume : "
                + volumeId
                + ", Concurrency : "
                + concurrency);
      } else if (volumeId == REMOTE) {
        // this case has processed all block on host and it will be assigned to remote
        LOG.info(
            "Assigned host : "
                + host
                + ", Remaining local tasks : "
                + getRemainingLocalTaskSize()
                + ", Remote Concurrency : "
                + concurrency);
      }
      diskVolumeLoads.put(volumeId, concurrency);
      return concurrency;
    }
Example #3
0
 public int getVolumeConcurrency(int volumeId) {
   Integer size = diskVolumeLoads.get(volumeId);
   if (size == null) return 0;
   else return size;
 }