diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolManager.java index 141550ef3b4..b03c51120ac 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolManager.java @@ -146,13 +146,25 @@ class BlockPoolManager { void refreshNamenodes(Configuration conf) throws IOException { - LOG.info("Refresh request received for nameservices: " + conf.get - (DFSConfigKeys.DFS_NAMESERVICES)); + LOG.info("Refresh request received for nameservices: " + + conf.get(DFSConfigKeys.DFS_NAMESERVICES)); - Map> newAddressMap = DFSUtil - .getNNServiceRpcAddressesForCluster(conf); - Map> newLifelineAddressMap = DFSUtil - .getNNLifelineRpcAddressesForCluster(conf); + Map> newAddressMap = null; + Map> newLifelineAddressMap = null; + + try { + newAddressMap = + DFSUtil.getNNServiceRpcAddressesForCluster(conf); + newLifelineAddressMap = + DFSUtil.getNNLifelineRpcAddressesForCluster(conf); + } catch (IOException ioe) { + LOG.warn("Unable to get NameNode addresses."); + } + + if (newAddressMap == null || newAddressMap.isEmpty()) { + throw new IOException("No services to connect, missing NameNode " + + "address."); + } synchronized (refreshNamenodesLock) { doRefreshNamenodes(newAddressMap, newLifelineAddressMap);