1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

update the field value and Optimizing Code Design for NacosContextRefresher

This commit is contained in:
pengbingting 2018-12-19 20:35:00 +08:00
parent 100a39da69
commit 50af7e2d32

View File

@ -64,7 +64,7 @@ public class NacosContextRefresher
private ApplicationContext applicationContext;
private AtomicBoolean ready = new AtomicBoolean(true);
private AtomicBoolean ready = new AtomicBoolean(false);
private Map<String, Listener> listenerMap = new ConcurrentHashMap<>(16);
@ -78,9 +78,8 @@ public class NacosContextRefresher
@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
// many Spring context
if (this.ready.get()) {
if (this.ready.compareAndSet(false, true)) {
this.registerNacosListenersForApplications();
this.ready.compareAndSet(true, false);
}
}