hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r412545 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
Date Wed, 07 Jun 2006 21:09:41 GMT
Author: cutting
Date: Wed Jun  7 14:09:40 2006
New Revision: 412545

URL: http://svn.apache.org/viewvc?rev=412545&view=rev
Log:
HADOOP-282.  Fix datanode to retry registration, rather than permanently fail if the namenode
is down when it starts.  Contributed by Owen.

Modified:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java?rev=412545&r1=412544&r2=412545&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/dfs/DataNode.java Wed Jun  7 14:09:40 2006
@@ -24,7 +24,6 @@
 
 import java.io.*;
 import java.net.*;
-import java.nio.channels.FileLock;
 import java.util.*;
 
 /**********************************************************
@@ -106,7 +105,17 @@
              new File(datadir),
              createSocketAddr(conf.get("fs.default.name", "local")), conf);
         // register datanode
-        register();
+        while (shouldRun) {
+          try {
+            register();
+            break;
+          } catch (ConnectException ce) {
+            LOG.info("Namenode not available yet, Zzzzz...");
+            try {
+              Thread.sleep(10 * 1000);
+            } catch (InterruptedException ie) {}
+          }
+        }
     }
 
     /**



Mime
View raw message