You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by na...@apache.org on 2018/01/27 10:54:59 UTC

hadoop git commit: HDFS-13072. Ozone: DatanodeStateMachine: Handling Uncaught Exception in command handler thread. Contributed by Nanda kumar.

Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 47149e7de -> d069734a4


HDFS-13072. Ozone: DatanodeStateMachine: Handling Uncaught Exception in command handler thread. Contributed by Nanda kumar.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/d069734a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/d069734a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/d069734a

Branch: refs/heads/HDFS-7240
Commit: d069734a418f741f58d794014d65f9b6a3243235
Parents: 47149e7
Author: Nanda kumar <na...@apache.org>
Authored: Sat Jan 27 16:24:24 2018 +0530
Committer: Nanda kumar <na...@apache.org>
Committed: Sat Jan 27 16:24:24 2018 +0530

----------------------------------------------------------------------
 .../common/statemachine/DatanodeStateMachine.java  | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/d069734a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
index c264650..de55d96 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
@@ -356,17 +356,22 @@ public class DatanodeStateMachine implements Closeable {
     };
 
     // We will have only one thread for command processing in a datanode.
-    cmdProcessThread = new Thread(processCommandQueue);
-    cmdProcessThread.setDaemon(true);
-    cmdProcessThread.setName("Command processor thread");
-    cmdProcessThread.setUncaughtExceptionHandler((Thread t, Throwable e) -> {
+    cmdProcessThread = getCommandHandlerThread(processCommandQueue);
+    cmdProcessThread.start();
+  }
+
+  private Thread getCommandHandlerThread(Runnable processCommandQueue) {
+    Thread handlerThread = new Thread(processCommandQueue);
+    handlerThread.setDaemon(true);
+    handlerThread.setName("Command processor thread");
+    handlerThread.setUncaughtExceptionHandler((Thread t, Throwable e) -> {
       // Let us just restart this thread after logging a critical error.
       // if this thread is not running we cannot handle commands from SCM.
       LOG.error("Critical Error : Command processor thread encountered an " +
           "error. Thread: {}", t.toString(), e);
-      cmdProcessThread.start();
+      getCommandHandlerThread(processCommandQueue).start();
     });
-    cmdProcessThread.start();
+    return handlerThread;
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org