This commit is contained in:
nkorange 2019-07-23 16:36:55 +08:00
parent d1127041cf
commit 8d453e62a8
2 changed files with 8 additions and 0 deletions

View File

@ -322,6 +322,11 @@ public class DistroConsistencyServiceImpl implements EphemeralConsistencyService
if (!listeners.containsKey(key)) {
listeners.put(key, new CopyOnWriteArrayList<>());
}
if (listeners.get(key).contains(listener)) {
return;
}
listeners.get(key).add(listener);
}

View File

@ -143,6 +143,9 @@ public class ServiceManager implements RecordListener<Service> {
if (oldDom != null) {
oldDom.update(service);
// re-listen to handle the situation when the underlying listener is removed:
consistencyService.listen(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), true), oldDom);
consistencyService.listen(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), false), oldDom);
} else {
putService(service);
service.init();