/** Send a heartbeat to the name-node. Ignore reply commands. */
 void sendHeartbeat() throws IOException {
   // register datanode
   DatanodeCommand[] cmds =
       nameNode.sendHeartbeat(
           dnRegistration, DF_CAPACITY, DF_USED, DF_CAPACITY - DF_USED, 0, 0, null);
   if (cmds != null) {
     for (DatanodeCommand cmd : cmds) {
       LOG.debug("sendHeartbeat Name-node reply: " + cmd.getAction());
     }
   }
 }
 /** Send a heartbeat to the name-node and replicate blocks if requested. */
 int replicateBlocks() throws IOException {
   // register datanode
   DatanodeCommand[] cmds =
       nameNode.sendHeartbeat(
           dnRegistration, DF_CAPACITY, DF_USED, DF_CAPACITY - DF_USED, 0, 0, null);
   if (cmds != null) {
     for (DatanodeCommand cmd : cmds) {
       if (cmd.getAction() == DatanodeProtocol.DNA_TRANSFER) {
         // Send a copy of a block to another datanode
         BlockCommand bcmd = (BlockCommand) cmd;
         return transferBlocks(bcmd.getBlocks(), bcmd.getTargets());
       }
     }
   }
   return 0;
 }