Use default primitive timeout in map keys/values/iterators

Change-Id: I72e3b24eb219b4f10b02406c94798b7581d4effa
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMap.java b/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMap.java
index ec93df3..645544d 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMap.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMap.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.store.atomix.primitives.impl;
 
+import java.time.Duration;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
@@ -108,7 +109,8 @@
 
     @Override
     public CompletableFuture<Set<K>> keySet() {
-        return CompletableFuture.completedFuture(atomixMap.keySet().sync());
+        return CompletableFuture.completedFuture(atomixMap.keySet()
+            .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
@@ -117,7 +119,8 @@
             new TranscodingAsyncDistributedCollection<Versioned<V>, io.atomix.utils.time.Versioned<V>>(
                 atomixMap.values(),
                 v -> new io.atomix.utils.time.Versioned<>(v.value(), v.version()),
-                v -> new Versioned<>(v.value(), v.version())).sync());
+                v -> new Versioned<>(v.value(), v.version()))
+                .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
@@ -129,7 +132,7 @@
                 e -> Maps.immutableEntry(e.getKey(),
                     new io.atomix.utils.time.Versioned<>(e.getValue().value(), e.getValue().version())),
                 e -> Maps.immutableEntry(e.getKey(), new Versioned<>(e.getValue().value(), e.getValue().version())))
-                .sync());
+                .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMultimap.java b/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMultimap.java
index 843d1d8..b7638c1 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMultimap.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentMultimap.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.store.atomix.primitives.impl;
 
+import java.time.Duration;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
@@ -127,22 +128,26 @@
 
     @Override
     public CompletableFuture<Set<K>> keySet() {
-        return CompletableFuture.completedFuture(atomixMultimap.keySet().sync());
+        return CompletableFuture.completedFuture(atomixMultimap.keySet()
+            .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
     public CompletableFuture<Multiset<K>> keys() {
-        return CompletableFuture.completedFuture(atomixMultimap.keys().sync());
+        return CompletableFuture.completedFuture(atomixMultimap.keys()
+            .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
     public CompletableFuture<Multiset<V>> values() {
-        return CompletableFuture.completedFuture(atomixMultimap.values().sync());
+        return CompletableFuture.completedFuture(atomixMultimap.values()
+            .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
     public CompletableFuture<Collection<Map.Entry<K, V>>> entries() {
-        return CompletableFuture.completedFuture(atomixMultimap.entries().sync());
+        return CompletableFuture.completedFuture(atomixMultimap.entries()
+            .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
@@ -158,7 +163,8 @@
                 Function.identity(),
                 Function.identity(),
                 v -> new io.atomix.utils.time.Versioned<>(v, 0),
-                v -> v.value()).sync());
+                v -> v.value())
+                .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentTreeMap.java b/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentTreeMap.java
index 7b70659..6b64139 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentTreeMap.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/atomix/primitives/impl/AtomixConsistentTreeMap.java
@@ -15,6 +15,7 @@
  */
 package org.onosproject.store.atomix.primitives.impl;
 
+import java.time.Duration;
 import java.util.Collection;
 import java.util.Map;
 import java.util.NavigableMap;
@@ -145,7 +146,8 @@
 
     @Override
     public CompletableFuture<NavigableSet<String>> navigableKeySet() {
-        return CompletableFuture.completedFuture(atomixTreeMap.navigableKeySet().sync());
+        return CompletableFuture.completedFuture(atomixTreeMap.navigableKeySet()
+            .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
@@ -158,7 +160,8 @@
         String upperKey, String lowerKey, boolean inclusiveUpper, boolean inclusiveLower) {
         return CompletableFuture.completedFuture(
             new DelegatingAsyncDistributedNavigableMap<>(
-                atomixTreeMap.subMap(lowerKey, inclusiveLower, upperKey, inclusiveUpper)).sync());
+                atomixTreeMap.subMap(lowerKey, inclusiveLower, upperKey, inclusiveUpper))
+                .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
@@ -185,7 +188,8 @@
 
     @Override
     public CompletableFuture<Set<String>> keySet() {
-        return CompletableFuture.completedFuture(atomixTreeMap.keySet().sync());
+        return CompletableFuture.completedFuture(atomixTreeMap.keySet()
+            .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override
@@ -259,7 +263,8 @@
             new TranscodingAsyncDistributedCollection<Versioned<V>, io.atomix.utils.time.Versioned<V>>(
                 atomixTreeMap.values(),
                 e -> new io.atomix.utils.time.Versioned<>(e.value(), e.version()),
-                e -> new Versioned<>(e.value(), e.version())).sync());
+                e -> new Versioned<>(e.value(), e.version()))
+                .sync(Duration.ofMillis(DEFAULT_OPERATION_TIMEOUT_MILLIS)));
     }
 
     @Override