Added sendAndReceive API to ClusterCommunicationService
diff --git a/core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterCommunicationService.java b/core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterCommunicationService.java
index 8b966ed..6fc150c 100644
--- a/core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterCommunicationService.java
+++ b/core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterCommunicationService.java
@@ -37,6 +37,15 @@
boolean multicast(ClusterMessage message, Set<NodeId> nodeIds) throws IOException;
/**
+ * Sends a message synchronously.
+ * @param message message to send
+ * @param toNodeId recipient node identifier
+ * @return ClusterMessageResponse which is reply future.
+ * @throws IOException
+ */
+ ClusterMessageResponse sendAndReceive(ClusterMessage message, NodeId toNodeId) throws IOException;
+
+ /**
* Adds a new subscriber for the specified message subject.
*
* @param subject message subject
diff --git a/core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterMessageResponse.java b/core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterMessageResponse.java
new file mode 100644
index 0000000..ae2089d
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/store/cluster/messaging/ClusterMessageResponse.java
@@ -0,0 +1,12 @@
+package org.onlab.onos.store.cluster.messaging;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.onlab.onos.cluster.NodeId;
+
+public interface ClusterMessageResponse {
+ public NodeId sender();
+ public byte[] get(long timeout, TimeUnit timeunit) throws TimeoutException;
+ public byte[] get(long timeout) throws InterruptedException;
+}