Remove "throws IOException" from ClusterCommunicationService APIs
that never throw IOExceptions. These APIs already return boolean to indicate
if sending failed.
Change-Id: I339949fe59f3b8b18a117aabc8d67402dc66c2a3
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java
index 8581da6..fb19d4d 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/impl/LeadershipManager.java
@@ -15,23 +15,16 @@
*/
package org.onosproject.store.cluster.impl;
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.onlab.util.Tools.namedThreads;
-import static org.slf4j.LoggerFactory.getLogger;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
+import org.onlab.util.KryoNamespace;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.Leadership;
import org.onosproject.cluster.LeadershipEvent;
@@ -47,12 +40,17 @@
import org.onosproject.store.service.Lock;
import org.onosproject.store.service.LockService;
import org.onosproject.store.service.impl.DistributedLockManager;
-import org.onlab.util.KryoNamespace;
import org.slf4j.Logger;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static org.onlab.util.Tools.namedThreads;
+import static org.slf4j.LoggerFactory.getLogger;
/**
* Distributed implementation of LeadershipService that is based on the primitives exposed by
@@ -286,15 +284,11 @@
public void event(LeadershipEvent event) {
// publish events originating on this host.
if (event.subject().leader().equals(localNodeId)) {
- try {
- clusterCommunicator.broadcast(
- new ClusterMessage(
- localNodeId,
- LEADERSHIP_UPDATES,
- SERIALIZER.encode(event)));
- } catch (IOException e) {
- log.error("Failed to broadcast leadership update message", e);
- }
+ clusterCommunicator.broadcast(
+ new ClusterMessage(
+ localNodeId,
+ LEADERSHIP_UPDATES,
+ SERIALIZER.encode(event)));
}
}
}
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/ClusterCommunicationManager.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/ClusterCommunicationManager.java
index d293eed..2868270 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/ClusterCommunicationManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/ClusterCommunicationManager.java
@@ -15,11 +15,7 @@
*/
package org.onosproject.store.cluster.messaging.impl;
-import static com.google.common.base.Preconditions.checkArgument;
-
-import java.io.IOException;
-import java.util.Set;
-
+import com.google.common.util.concurrent.ListenableFuture;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -31,6 +27,7 @@
import org.onlab.netty.MessageHandler;
import org.onlab.netty.MessagingService;
import org.onlab.netty.NettyMessagingService;
+import org.onlab.util.KryoNamespace;
import org.onosproject.cluster.ClusterService;
import org.onosproject.cluster.ControllerNode;
import org.onosproject.cluster.NodeId;
@@ -42,11 +39,13 @@
import org.onosproject.store.serializers.KryoSerializer;
import org.onosproject.store.serializers.impl.ClusterMessageSerializer;
import org.onosproject.store.serializers.impl.MessageSubjectSerializer;
-import org.onlab.util.KryoNamespace;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.util.concurrent.ListenableFuture;
+import java.io.IOException;
+import java.util.Set;
+
+import static com.google.common.base.Preconditions.checkArgument;
@Component(immediate = true)
@Service
@@ -101,7 +100,7 @@
}
@Override
- public boolean broadcast(ClusterMessage message) throws IOException {
+ public boolean broadcast(ClusterMessage message) {
boolean ok = true;
final ControllerNode localNode = clusterService.getLocalNode();
for (ControllerNode node : clusterService.getNodes()) {
@@ -113,7 +112,7 @@
}
@Override
- public boolean broadcastIncludeSelf(ClusterMessage message) throws IOException {
+ public boolean broadcastIncludeSelf(ClusterMessage message) {
boolean ok = true;
for (ControllerNode node : clusterService.getNodes()) {
ok = unicastUnchecked(message, node.id()) && ok;
@@ -122,7 +121,7 @@
}
@Override
- public boolean multicast(ClusterMessage message, Set<NodeId> nodes) throws IOException {
+ public boolean multicast(ClusterMessage message, Set<NodeId> nodes) {
boolean ok = true;
final ControllerNode localNode = clusterService.getLocalNode();
for (NodeId nodeId : nodes) {
@@ -148,7 +147,7 @@
}
}
- private boolean unicastUnchecked(ClusterMessage message, NodeId toNodeId) throws IOException {
+ private boolean unicastUnchecked(ClusterMessage message, NodeId toNodeId) {
try {
return unicast(message, toNodeId);
} catch (IOException e) {