You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2019/07/11 01:02:35 UTC

[incubator-pinot] branch cluster_change_mediator created (now b47866e)

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

jackie pushed a change to branch cluster_change_mediator
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at b47866e  In ClusterChangeMediator, stop enqueue/process changes if already stopped

This branch includes the following new commits:

     new b47866e  In ClusterChangeMediator, stop enqueue/process changes if already stopped

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: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[incubator-pinot] 01/01: In ClusterChangeMediator, stop enqueue/process changes if already stopped

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

jackie pushed a commit to branch cluster_change_mediator
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit b47866e64378ce8a59493efa221244b051f24d5c
Author: Jackie (Xiaotian) Jiang <xa...@linkedin.com>
AuthorDate: Wed Jul 10 17:59:57 2019 -0700

    In ClusterChangeMediator, stop enqueue/process changes if already stopped
---
 .../pinot/broker/broker/helix/ClusterChangeMediator.java     | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java
index 64b2a1e..e021163 100644
--- a/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java
+++ b/pinot-broker/src/main/java/org/apache/pinot/broker/broker/helix/ClusterChangeMediator.java
@@ -62,7 +62,7 @@ public class ClusterChangeMediator implements ExternalViewChangeListener, Instan
 
   private final Thread _clusterChangeHandlingThread;
 
-  private volatile boolean _stopped = false;
+  private boolean _stopped = false;
 
   public ClusterChangeMediator(Map<ChangeType, List<ClusterChangeHandler>> changeHandlersMap,
       BrokerMetrics brokerMetrics) {
@@ -145,7 +145,7 @@ public class ClusterChangeMediator implements ExternalViewChangeListener, Instan
   /**
    * Starts the cluster change mediator.
    */
-  public void start() {
+  public synchronized void start() {
     LOGGER.info("Starting the cluster change handling thread");
     _clusterChangeHandlingThread.start();
   }
@@ -153,7 +153,7 @@ public class ClusterChangeMediator implements ExternalViewChangeListener, Instan
   /**
    * Stops the cluster change mediator.
    */
-  public void stop() {
+  public synchronized void stop() {
     LOGGER.info("Stopping the cluster change handling thread");
     _stopped = true;
     synchronized (_lastChangeTimeMap) {
@@ -197,7 +197,11 @@ public class ClusterChangeMediator implements ExternalViewChangeListener, Instan
    *
    * @param changeType Type of the change
    */
-  private void enqueueChange(ChangeType changeType) {
+  private synchronized void enqueueChange(ChangeType changeType) {
+    // Do not enqueue or process changes if already stopped
+    if (_stopped) {
+      return;
+    }
     if (_clusterChangeHandlingThread.isAlive()) {
       LOGGER.info("Enqueue {} change", changeType);
       synchronized (_lastChangeTimeMap) {


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