ONOS-180 Suppressing a few superfluous stack traces on shutdown.
Change-Id: If648b9d7658e8ee57a0e9eb157b12120f0ea20bd
diff --git a/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java b/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
index f20a3f9..2f17324 100644
--- a/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
+++ b/openflow/api/src/main/java/org/onosproject/openflow/controller/driver/AbstractOpenFlowSwitch.java
@@ -21,6 +21,7 @@
import java.net.SocketAddress;
import java.util.Collections;
import java.util.List;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicInteger;
import org.jboss.netty.channel.Channel;
@@ -50,6 +51,8 @@
protected final Logger log = LoggerFactory.getLogger(getClass());
+ private static final String SHUTDOWN_MSG = "Worker has already been shutdown";
+
protected Channel channel;
protected String channelId;
@@ -97,14 +100,26 @@
@Override
public final void sendMsg(OFMessage m) {
if (role == RoleState.MASTER) {
- this.write(m);
+ try {
+ this.write(m);
+ } catch (RejectedExecutionException e) {
+ if (!e.getMessage().contains(SHUTDOWN_MSG)) {
+ throw e;
+ }
+ }
}
}
@Override
public final void sendMsg(List<OFMessage> msgs) {
if (role == RoleState.MASTER) {
- this.write(msgs);
+ try {
+ this.write(msgs);
+ } catch (RejectedExecutionException e) {
+ if (!e.getMessage().contains(SHUTDOWN_MSG)) {
+ throw e;
+ }
+ }
}
}
@@ -296,7 +311,6 @@
}
} else {
log.warn("Failed to set role for {}", this.getStringId());
- return;
}
}