|
|
|
@ -22,6 +22,7 @@ import java.util.Map;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
|
|
|
|
|
import com.alibaba.cloud.nacos.NacosServiceManager;
|
|
|
|
@ -51,6 +52,8 @@ public class NacosWatch implements ApplicationEventPublisherAware, SmartLifecycl
|
|
|
|
|
|
|
|
|
|
private final AtomicBoolean running = new AtomicBoolean(false);
|
|
|
|
|
|
|
|
|
|
private final AtomicLong nacosWatchIndex = new AtomicLong(0);
|
|
|
|
|
|
|
|
|
|
private ApplicationEventPublisher publisher;
|
|
|
|
|
|
|
|
|
|
private NacosServiceManager nacosServiceManager;
|
|
|
|
@ -93,9 +96,9 @@ public class NacosWatch implements ApplicationEventPublisherAware, SmartLifecycl
|
|
|
|
|
instances);
|
|
|
|
|
instanceOptional.ifPresent(currentInstance -> {
|
|
|
|
|
resetIfNeeded(currentInstance);
|
|
|
|
|
publisher.publishEvent(
|
|
|
|
|
new HeartbeatEvent(this, currentInstance));
|
|
|
|
|
});
|
|
|
|
|
publisher.publishEvent(
|
|
|
|
|
new HeartbeatEvent(this, nacosWatchIndex.getAndIncrement()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|