Commit 994e003d by Yunlong Liang

Add callback to defferdResult before putting to the map.

parent 49ecba4c
...@@ -150,11 +150,6 @@ public class NotificationControllerV2 implements ReleaseMessageListener { ...@@ -150,11 +150,6 @@ public class NotificationControllerV2 implements ReleaseMessageListener {
if (!CollectionUtils.isEmpty(newNotifications)) { if (!CollectionUtils.isEmpty(newNotifications)) {
deferredResultWrapper.setResult(newNotifications); deferredResultWrapper.setResult(newNotifications);
} else { } else {
//register all keys
for (String key : watchedKeys) {
this.deferredResults.put(key, deferredResultWrapper);
}
deferredResultWrapper deferredResultWrapper
.onTimeout(() -> logWatchedKeys(watchedKeys, "Apollo.LongPoll.TimeOutKeys")); .onTimeout(() -> logWatchedKeys(watchedKeys, "Apollo.LongPoll.TimeOutKeys"));
...@@ -166,6 +161,11 @@ public class NotificationControllerV2 implements ReleaseMessageListener { ...@@ -166,6 +161,11 @@ public class NotificationControllerV2 implements ReleaseMessageListener {
logWatchedKeys(watchedKeys, "Apollo.LongPoll.CompletedKeys"); logWatchedKeys(watchedKeys, "Apollo.LongPoll.CompletedKeys");
}); });
//register all keys
for (String key : watchedKeys) {
this.deferredResults.put(key, deferredResultWrapper);
}
logWatchedKeys(watchedKeys, "Apollo.LongPoll.RegisteredKeys"); logWatchedKeys(watchedKeys, "Apollo.LongPoll.RegisteredKeys");
logger.debug("Listening {} from appId: {}, cluster: {}, namespace: {}, datacenter: {}", logger.debug("Listening {} from appId: {}, cluster: {}, namespace: {}, datacenter: {}",
watchedKeys, appId, cluster, namespaces, dataCenter); watchedKeys, appId, cluster, namespaces, dataCenter);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment