Browse Source

HADOOP-5890 exponential backoff of sleep during DN shutdown

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@778368 13f79535-47bb-0310-9956-ffa450edef68
Steve Loughran 16 years ago
parent
commit
c18881afb0
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java

+ 6 - 1
src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java

@@ -632,6 +632,7 @@ public class DataNode extends Configured
 
       // wait for all data receiver threads to exit
       if (this.threadGroup != null) {
+        int sleepMs = 2;
         while (true) {
           this.threadGroup.interrupt();
           LOG.info("Waiting for threadgroup to exit, active threads is " +
@@ -640,8 +641,12 @@ public class DataNode extends Configured
             break;
           }
           try {
-            Thread.sleep(1000);
+            Thread.sleep(sleepMs);
           } catch (InterruptedException e) {}
+          sleepMs = sleepMs * 3 / 2; // exponential backoff
+          if (sleepMs > 1000) {
+            sleepMs = 1000;
+          }
         }
       }
       // wait for dataXceiveServer to terminate