diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
index 986b42cb412..7ada04a6ac9 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ZKFailoverController.java
@@ -183,45 +183,40 @@ public Integer run() {
}
});
} catch (RuntimeException rte) {
+ LOG.error("The failover controller encounters runtime error: " + rte);
throw (Exception)rte.getCause();
}
}
private int doRun(String[] args)
- throws Exception {
+ throws HadoopIllegalArgumentException, IOException, InterruptedException {
try {
initZK();
} catch (KeeperException ke) {
LOG.error("Unable to start failover controller. Unable to connect "
+ "to ZooKeeper quorum at " + zkQuorum + ". Please check the "
+ "configured value for " + ZK_QUORUM_KEY + " and ensure that "
- + "ZooKeeper is running.", ke);
+ + "ZooKeeper is running.");
return ERR_CODE_NO_ZK;
}
- try {
- if (args.length > 0) {
- if ("-formatZK".equals(args[0])) {
- boolean force = false;
- boolean interactive = true;
- for (int i = 1; i < args.length; i++) {
- if ("-force".equals(args[i])) {
- force = true;
- } else if ("-nonInteractive".equals(args[i])) {
- interactive = false;
- } else {
- badArg(args[i]);
- }
+ if (args.length > 0) {
+ if ("-formatZK".equals(args[0])) {
+ boolean force = false;
+ boolean interactive = true;
+ for (int i = 1; i < args.length; i++) {
+ if ("-force".equals(args[i])) {
+ force = true;
+ } else if ("-nonInteractive".equals(args[i])) {
+ interactive = false;
+ } else {
+ badArg(args[i]);
}
- return formatZK(force, interactive);
- }
- else {
- badArg(args[0]);
}
+ return formatZK(force, interactive);
+ } else {
+ badArg(args[0]);
}
- } catch (Exception e){
- LOG.error("The failover controller encounters runtime error", e);
- throw e;
}
if (!elector.parentZNodeExists()) {
@@ -240,14 +235,11 @@ private int doRun(String[] args)
return ERR_CODE_NO_FENCER;
}
+ initRPC();
+ initHM();
+ startRPC();
try {
- initRPC();
- initHM();
- startRPC();
mainLoop();
- } catch (Exception e) {
- LOG.error("The failover controller encounters runtime error: ", e);
- throw e;
} finally {
rpcServer.stopAndJoin();
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java
index caa2584c8c3..5f22f93af44 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/concurrent/ExecutorHelper.java
@@ -40,16 +40,14 @@ static void logThrowableFromAfterExecute(Runnable r, Throwable t) {
//For additional information, see: https://docs.oracle
// .com/javase/7/docs/api/java/util/concurrent/ThreadPoolExecutor
- // .html#afterExecute(java.lang.Runnable,%20java.lang.Throwable)
+ // .html#afterExecute(java.lang.Runnable,%20java.lang.Throwable) .
- // Handle JDK-8071638
- if (t == null && r instanceof Future> && ((Future>) r).isDone()) {
+ if (t == null && r instanceof Future>) {
try {
((Future>) r).get();
} catch (ExecutionException ee) {
- LOG.warn(
- "Execution exception when running task in " + Thread.currentThread()
- .getName());
+ LOG.warn("Execution exception when running task in " +
+ Thread.currentThread().getName());
t = ee.getCause();
} catch (InterruptedException ie) {
LOG.warn("Thread (" + Thread.currentThread() + ") interrupted: ", ie);
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
index a710748b014..ff3fd68b738 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSZKFailoverController.java
@@ -192,8 +192,7 @@ public static void main(String args[])
try {
retCode = zkfc.run(parser.getRemainingArgs());
} catch (Throwable t) {
- LOG.fatal("DFSZKFailOverController exiting due to earlier exception "
- + t);
+ LOG.fatal("Got a fatal error, exiting now", t);
}
System.exit(retCode);
}
diff --git a/hadoop-project/src/site/site.xml b/hadoop-project/src/site/site.xml
index 62e9deb6667..e20fdecd9c5 100644
--- a/hadoop-project/src/site/site.xml
+++ b/hadoop-project/src/site/site.xml
@@ -100,7 +100,6 @@
-