Removed ClockService<K, V> and replaced its usage with a BiFunction<K, V, Timestamp>
Change-Id: Ide8d979f9361f1aff6727a83733747f4512ef8ff
diff --git a/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java b/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
index 18ecefe..b78b0d3 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
@@ -37,7 +37,6 @@
import org.onosproject.store.impl.Timestamped;
import org.onosproject.store.service.WallClockTimestamp;
import org.onosproject.store.serializers.KryoSerializer;
-import org.onosproject.store.service.ClockService;
import org.onosproject.store.service.EventuallyConsistentMap;
import org.onosproject.store.service.EventuallyConsistentMapEvent;
import org.onosproject.store.service.EventuallyConsistentMapListener;
@@ -84,7 +83,7 @@
private final ClusterCommunicationService clusterCommunicator;
private final KryoSerializer serializer;
- private final ClockService<K, V> clockService;
+ private final BiFunction<K, V, Timestamp> timestampProvider;
private final MessageSubject updateMessageSubject;
private final MessageSubject antiEntropyAdvertisementSubject;
@@ -130,8 +129,7 @@
* @param clusterCommunicator the cluster communications service
* @param serializerBuilder a Kryo namespace builder that can serialize
* both K and V
- * @param clockService a clock service able to generate timestamps
- * for K and V
+ * @param timestampProvider provider of timestamps for K and V
* @param peerUpdateFunction function that provides a set of nodes to immediately
* update to when there writes to the map
* @param eventExecutor executor to use for processing incoming
@@ -150,7 +148,7 @@
ClusterService clusterService,
ClusterCommunicationService clusterCommunicator,
KryoNamespace.Builder serializerBuilder,
- ClockService<K, V> clockService,
+ BiFunction<K, V, Timestamp> timestampProvider,
BiFunction<K, V, Collection<NodeId>> peerUpdateFunction,
ExecutorService eventExecutor,
ExecutorService communicationExecutor,
@@ -170,7 +168,7 @@
this.serializer = createSerializer(serializerBuilder);
- this.clockService = clockService;
+ this.timestampProvider = timestampProvider;
if (peerUpdateFunction != null) {
this.peerUpdateFunction = peerUpdateFunction;
@@ -302,7 +300,7 @@
checkNotNull(key, ERROR_NULL_KEY);
checkNotNull(value, ERROR_NULL_VALUE);
- Timestamp timestamp = clockService.getTimestamp(key, value);
+ Timestamp timestamp = timestampProvider.apply(key, value);
if (putInternal(key, value, timestamp)) {
notifyPeers(new PutEntry<>(key, value, timestamp),
@@ -354,7 +352,7 @@
checkNotNull(key, ERROR_NULL_KEY);
// TODO prevent calls here if value is important for timestamp
- Timestamp timestamp = clockService.getTimestamp(key, null);
+ Timestamp timestamp = timestampProvider.apply(key, null);
if (removeInternal(key, timestamp)) {
notifyPeers(new RemoveEntry<>(key, timestamp),
@@ -412,7 +410,7 @@
checkNotNull(key, ERROR_NULL_KEY);
checkNotNull(value, ERROR_NULL_VALUE);
- Timestamp timestamp = clockService.getTimestamp(key, value);
+ Timestamp timestamp = timestampProvider.apply(key, value);
if (removeInternal(key, timestamp)) {
notifyPeers(new RemoveEntry<>(key, timestamp),