Support user-provided timeouts in intra-cluster communication service
Change-Id: I4ed9cd2e84df83b45ae17af24b9780b9ac97a95d
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DeviceFlowTable.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DeviceFlowTable.java
index 0ffd59c..f3206c3 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DeviceFlowTable.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DeviceFlowTable.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.store.flow.impl;
+import java.time.Duration;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
@@ -73,6 +74,7 @@
.register(LogicalTimestamp.class)
.register(Timestamped.class)
.build());
+ private static final int GET_FLOW_ENTRIES_TIMEOUT = 15; // seconds
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -243,7 +245,8 @@
getFlowsSubject,
SERIALIZER::encode,
SERIALIZER::decode,
- replicaInfo.master());
+ replicaInfo.master(),
+ Duration.ofSeconds(GET_FLOW_ENTRIES_TIMEOUT));
} else {
return CompletableFuture.completedFuture(Collections.emptySet());
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
index 9a68356..b4e80a8 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java
@@ -136,6 +136,7 @@
private final Logger log = getLogger(getClass());
private static final long FLOW_RULE_STORE_TIMEOUT_MILLIS = 5000;
+ private static final int GET_FLOW_ENTRIES_TIMEOUT = 30; //seconds
/** Number of threads in the message handler pool. */
private int msgHandlerPoolSize = MESSAGE_HANDLER_THREAD_POOL_SIZE_DEFAULT;
@@ -783,7 +784,7 @@
public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) {
try {
return getFlowTable(deviceId).getFlowEntries()
- .get(FLOW_RULE_STORE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS);
+ .get(GET_FLOW_ENTRIES_TIMEOUT, TimeUnit.SECONDS);
} catch (ExecutionException e) {
throw new FlowRuleStoreException(e.getCause());
} catch (TimeoutException e) {