This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new aadcd36 In ClusterChangeMediator, stop enqueue/process changes if
already stopped (#4422)
aadcd36 is described below
commit aadcd36289c0da12f6f7e164928070a3ccb2d103
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Thu Jul 11 11:32:07 2019 -0700
In ClusterChangeMediator, stop enqueue/process changes if already stopped
(#4422)
---
.../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: [email protected]
For additional commands, e-mail: [email protected]