You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by di...@apache.org on 2020/06/03 01:50:50 UTC

[hadoop-ozone] 01/01: Revert "HDDS-2562. Handle InterruptedException in DatanodeStateMachine (#969)"

This is an automated email from the ASF dual-hosted git repository.

dineshc pushed a commit to branch revert-969-HDDS-2562
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git

commit d2e0c1e11571c0348c1cc24655569a825e853267
Author: Dinesh Chitlangia <di...@gmail.com>
AuthorDate: Tue Jun 2 21:50:37 2020 -0400

    Revert "HDDS-2562. Handle InterruptedException in DatanodeStateMachine (#969)"
    
    This reverts commit 4c68299f8cc1bfd3705c40d9ca293a252511cb1c.
---
 .../common/statemachine/DatanodeStateMachine.java    | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
index e77938e..e41a537 100644
--- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
+++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
@@ -192,7 +192,7 @@ public class DatanodeStateMachine implements Closeable {
     long now = 0;
 
     reportManager.init();
-    initCommandHandlerThread();
+    initCommandHandlerThread(conf);
 
     // Start jvm monitor
     jvmPauseMonitor = new JvmPauseMonitor();
@@ -208,15 +208,15 @@ public class DatanodeStateMachine implements Closeable {
         context.execute(executorService, heartbeatFrequency,
             TimeUnit.MILLISECONDS);
         now = Time.monotonicNow();
-        if (now < nextHB.get() && !Thread.interrupted()) {
-          Thread.sleep(nextHB.get() - now);
+        if (now < nextHB.get()) {
+          if(!Thread.interrupted()) {
+            Thread.sleep(nextHB.get() - now);
+          }
         }
       } catch (InterruptedException e) {
         // Some one has sent interrupt signal, this could be because
         // 1. Trigger heartbeat immediately
-        // 2. Shutdown has been initiated.
-        Thread.currentThread().interrupt();
-        throw new IOException("Unable to finish the execution.", e);
+        // 2. Shutdown has be initiated.
       } catch (Exception e) {
         LOG.error("Unable to finish the execution.", e);
       }
@@ -442,14 +442,16 @@ public class DatanodeStateMachine implements Closeable {
 
   /**
    * Create a command handler thread.
+   *
+   * @param config
    */
-  private void initCommandHandlerThread() {
+  private void initCommandHandlerThread(ConfigurationSource config) {
 
     /**
      * Task that periodically checks if we have any outstanding commands.
      * It is assumed that commands can be processed slowly and in order.
      * This assumption might change in future. Right now due to this assumption
-     * we have single command queue process thread.
+     * we have single command  queue process thread.
      */
     Runnable processCommandQueue = () -> {
       long now;
@@ -466,7 +468,7 @@ public class DatanodeStateMachine implements Closeable {
               Thread.sleep((nextHB.get() - now) + 1000L);
             }
           } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
+            // Ignore this exception.
           }
         }
       }


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