From 4d3e1422fa5976a97161736bf0c9f0d4fe4202bb Mon Sep 17 00:00:00 2001 From: Ashlee <59916531+ashlee618@users.noreply.github.com> Date: Sat, 8 Jul 2023 17:10:12 +0800 Subject: [PATCH] remove redundant volatile (#329) * perf: remove redundant volatile * fix: leaderInfo should be use volatile * fix: recover these variables are use volatile that the get method is not protect by synchronized. * fix: the get method of pushedVersion and attributes is not protect by synchronized when in print log. --- .../sofa/registry/store/api/elector/AbstractLeaderElector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/elector/AbstractLeaderElector.java b/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/elector/AbstractLeaderElector.java index 8792b0ad7..7ec84651c 100644 --- a/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/elector/AbstractLeaderElector.java +++ b/server/store/api/src/main/java/com/alipay/sofa/registry/store/api/elector/AbstractLeaderElector.java @@ -41,7 +41,7 @@ public abstract class AbstractLeaderElector implements LeaderElector { private volatile boolean startElector = false; - private volatile boolean isObserver = false; + private boolean isObserver = false; private final LeaderElectorTrigger leaderElectorTrigger = new LeaderElectorTrigger();