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 ar...@apache.org on 2019/07/25 23:18:12 UTC

[hadoop] branch revert-1156-HDDS-1830 created (now 74937b8)

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

arp pushed a change to branch revert-1156-HDDS-1830
in repository https://gitbox.apache.org/repos/asf/hadoop.git.


      at 74937b8  Revert "HDDS-1830 OzoneManagerDoubleBuffer#stop should wait for daemon thread to die (#1156)"

This branch includes the following new commits:

     new 74937b8  Revert "HDDS-1830 OzoneManagerDoubleBuffer#stop should wait for daemon thread to die (#1156)"

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[hadoop] 01/01: Revert "HDDS-1830 OzoneManagerDoubleBuffer#stop should wait for daemon thread to die (#1156)"

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

arp pushed a commit to branch revert-1156-HDDS-1830
in repository https://gitbox.apache.org/repos/asf/hadoop.git

commit 74937b8286753671deb4e9e4e16b24d182dde28b
Author: Arpit Agarwal <ar...@users.noreply.github.com>
AuthorDate: Thu Jul 25 16:18:04 2019 -0700

    Revert "HDDS-1830 OzoneManagerDoubleBuffer#stop should wait for daemon thread to die (#1156)"
    
    This reverts commit b7fba78fb63a0971835db87292822fd8cd4aa7ad.
---
 .../ozone/om/ratis/OzoneManagerDoubleBuffer.java     | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
index e329d5a..2bde3ad 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
@@ -21,7 +21,6 @@ package org.apache.hadoop.ozone.om.ratis;
 import java.io.IOException;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -65,7 +64,7 @@ public class OzoneManagerDoubleBuffer {
   private final OMMetadataManager omMetadataManager;
   private final AtomicLong flushedTransactionCount = new AtomicLong(0);
   private final AtomicLong flushIterations = new AtomicLong(0);
-  private final AtomicBoolean isRunning = new AtomicBoolean(false);
+  private volatile boolean isRunning;
   private OzoneManagerDoubleBufferMetrics ozoneManagerDoubleBufferMetrics;
   private long maxFlushedTransactionsInOneIteration;
 
@@ -80,7 +79,7 @@ public class OzoneManagerDoubleBuffer {
     this.ozoneManagerDoubleBufferMetrics =
         OzoneManagerDoubleBufferMetrics.create();
 
-    isRunning.set(true);
+    isRunning = true;
     // Daemon thread which runs in back ground and flushes transactions to DB.
     daemon = new Daemon(this::flushTransactions);
     daemon.setName("OMDoubleBufferFlushThread");
@@ -93,7 +92,7 @@ public class OzoneManagerDoubleBuffer {
    * and commit to DB.
    */
   private void flushTransactions() {
-    while (isRunning.get()) {
+    while(isRunning) {
       try {
         if (canFlush()) {
           setReadyBuffer();
@@ -141,7 +140,7 @@ public class OzoneManagerDoubleBuffer {
         }
       } catch (InterruptedException ex) {
         Thread.currentThread().interrupt();
-        if (isRunning.get()) {
+        if (isRunning) {
           final String message = "OMDoubleBuffer flush thread " +
               Thread.currentThread().getName() + " encountered Interrupted " +
               "exception while running";
@@ -202,16 +201,11 @@ public class OzoneManagerDoubleBuffer {
   /**
    * Stop OM DoubleBuffer flush thread.
    */
-  public void stop() {
-    if (isRunning.compareAndSet(true, false)) {
+  public synchronized void stop() {
+    if (isRunning) {
       LOG.info("Stopping OMDoubleBuffer flush thread");
+      isRunning = false;
       daemon.interrupt();
-      try {
-        // Wait for daemon thread to exit
-        daemon.join();
-      } catch (InterruptedException e) {
-        LOG.error("Interrupted while waiting for daemon to exit.");
-      }
 
       // stop metrics.
       ozoneManagerDoubleBufferMetrics.unRegister();


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