Exemplo n.º 1
0
 /** Adjusts curr and prev number of blocks scheduled every few minutes. */
 private void rollBlocksScheduled(long now) {
   if (now - lastBlocksScheduledRollTime > BLOCKS_SCHEDULED_ROLL_INTERVAL) {
     prevApproxBlocksScheduled.set(currApproxBlocksScheduled);
     currApproxBlocksScheduled.reset();
     lastBlocksScheduledRollTime = now;
   }
 }
Exemplo n.º 2
0
 /** Decrement the number of blocks scheduled. */
 void decrementBlocksScheduled(StorageType t) {
   if (prevApproxBlocksScheduled.get(t) > 0) {
     prevApproxBlocksScheduled.subtract(t, 1);
   } else if (currApproxBlocksScheduled.get(t) > 0) {
     currApproxBlocksScheduled.subtract(t, 1);
   }
   // its ok if both counters are zero.
 }
Exemplo n.º 3
0
 /** @return Approximate number of blocks currently scheduled to be written to this datanode. */
 public int getBlocksScheduled() {
   return (int) (currApproxBlocksScheduled.sum() + prevApproxBlocksScheduled.sum());
 }
Exemplo n.º 4
0
 /** Increment the number of blocks scheduled. */
 void incrementBlocksScheduled(StorageType t) {
   currApproxBlocksScheduled.add(t, 1);
   ;
 }
Exemplo n.º 5
0
 /**
  * @return Approximate number of blocks currently scheduled to be written to the given storage
  *     type of this datanode.
  */
 public int getBlocksScheduled(StorageType t) {
   return (int) (currApproxBlocksScheduled.get(t) + prevApproxBlocksScheduled.get(t));
 }