GossipApplicationStore fix to prevent attempt to notify delegate when there isn't one yet. Fixes an intermittent NPE.
Change-Id: I49a2f0da08949fb4f589e6e831a74e5728196a2f
diff --git a/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java b/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java
index d8ce7d5..935561d 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/app/GossipApplicationStore.java
@@ -271,6 +271,13 @@
implements EventuallyConsistentMapListener<Application, InternalState> {
@Override
public void event(EventuallyConsistentMapEvent<Application, InternalState> event) {
+ // If we do not have a delegate, refuse to process any events entirely.
+ // This is to allow the anti-entropy to kick in and process the events
+ // perhaps a bit later, but with opportunity to notify delegate.
+ if (delegate == null) {
+ return;
+ }
+
Application app = event.key();
InternalState state = event.value();