Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next
diff --git a/core/api/src/main/java/org/onlab/onos/store/AbstractStore.java b/core/api/src/main/java/org/onlab/onos/store/AbstractStore.java
index 5d76e0f..e7668d0 100644
--- a/core/api/src/main/java/org/onlab/onos/store/AbstractStore.java
+++ b/core/api/src/main/java/org/onlab/onos/store/AbstractStore.java
@@ -1,5 +1,7 @@
package org.onlab.onos.store;
+import java.util.List;
+
import org.onlab.onos.event.Event;
import static com.google.common.base.Preconditions.checkState;
@@ -41,4 +43,15 @@
delegate.notify(event);
}
}
+
+ /**
+ * Notifies the delegate with the specified list of events.
+ *
+ * @param events list of events to delegate
+ */
+ protected void notifyDelegate(List<E> events) {
+ for (E event: events) {
+ notifyDelegate(event);
+ }
+ }
}
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
index f39413b..2221ea0 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/device/impl/GossipDeviceStore.java
@@ -870,6 +870,12 @@
clusterCommunicator.broadcast(message);
}
+ private void notifyDelegateIfNotNull(DeviceEvent event) {
+ if (event != null) {
+ notifyDelegate(event);
+ }
+ }
+
private class InternalDeviceEventListener implements ClusterMessageHandler {
@Override
public void handle(ClusterMessage message) {
@@ -881,7 +887,7 @@
DeviceId deviceId = event.deviceId();
Timestamped<DeviceDescription> deviceDescription = event.deviceDescription();
- createOrUpdateDeviceInternal(providerId, deviceId, deviceDescription);
+ notifyDelegateIfNotNull(createOrUpdateDeviceInternal(providerId, deviceId, deviceDescription));
}
}
@@ -895,7 +901,7 @@
DeviceId deviceId = event.deviceId();
Timestamp timestamp = event.timestamp();
- markOfflineInternal(deviceId, timestamp);
+ notifyDelegateIfNotNull(markOfflineInternal(deviceId, timestamp));
}
}
@@ -909,7 +915,7 @@
DeviceId deviceId = event.deviceId();
Timestamp timestamp = event.timestamp();
- removeDeviceInternal(deviceId, timestamp);
+ notifyDelegateIfNotNull(removeDeviceInternal(deviceId, timestamp));
}
}
@@ -924,7 +930,7 @@
DeviceId deviceId = event.deviceId();
Timestamped<List<PortDescription>> portDescriptions = event.portDescriptions();
- updatePortsInternal(providerId, deviceId, portDescriptions);
+ notifyDelegate(updatePortsInternal(providerId, deviceId, portDescriptions));
}
}
@@ -939,7 +945,7 @@
DeviceId deviceId = event.deviceId();
Timestamped<PortDescription> portDescription = event.portDescription();
- updatePortStatusInternal(providerId, deviceId, portDescription);
+ notifyDelegateIfNotNull(updatePortStatusInternal(providerId, deviceId, portDescription));
}
}
}