From f32d6c864a1df77e571b07cbdddb53ad457e1b22 Mon Sep 17 00:00:00 2001 From: nkorange Date: Mon, 6 Jan 2020 16:27:01 +0800 Subject: [PATCH] #2232 Code consistency --- .../distro/DistroConsistencyServiceImpl.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java index 744d76fd7..e4c027254 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java @@ -40,7 +40,10 @@ import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.concurrent.*; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.LinkedBlockingQueue; /** * A consistency protocol algorithm called Distro @@ -82,7 +85,9 @@ public class DistroConsistencyServiceImpl implements EphemeralConsistencyService private boolean initialized = false; - public volatile Notifier notifier = new Notifier(); + private volatile Notifier notifier = new Notifier(); + + private LoadDataTask loadDataTask = new LoadDataTask(); private Map> listeners = new ConcurrentHashMap<>(); @@ -90,7 +95,7 @@ public class DistroConsistencyServiceImpl implements EphemeralConsistencyService @PostConstruct public void init() { - GlobalExecutor.submit(new LoadDataTask()); + GlobalExecutor.submit(loadDataTask); GlobalExecutor.submitDistroNotifyTask(notifier); }