[ONOS-4385] Handle flow removed message type in all cases

- Do not handle packet in messages inside ControllerImpl class

Change-Id: Idcb26b277b790125bd6b3ba8f10bb4c60e2a3c58
diff --git a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
index 11c9f20..333a756 100644
--- a/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/protocols/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -48,8 +48,6 @@
 import org.projectfloodlight.openflow.protocol.OFFactories;
 import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry;
 import org.projectfloodlight.openflow.protocol.OFFlowStatsReply;
-import org.projectfloodlight.openflow.protocol.OFTableStatsEntry;
-import org.projectfloodlight.openflow.protocol.OFTableStatsReply;
 import org.projectfloodlight.openflow.protocol.OFGroupDescStatsEntry;
 import org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply;
 import org.projectfloodlight.openflow.protocol.OFGroupStatsEntry;
@@ -62,6 +60,8 @@
 import org.projectfloodlight.openflow.protocol.OFPortStatus;
 import org.projectfloodlight.openflow.protocol.OFStatsReply;
 import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags;
+import org.projectfloodlight.openflow.protocol.OFTableStatsEntry;
+import org.projectfloodlight.openflow.protocol.OFTableStatsReply;
 import org.projectfloodlight.openflow.protocol.action.OFActionOutput;
 import org.projectfloodlight.openflow.protocol.instruction.OFInstruction;
 import org.slf4j.Logger;
@@ -79,6 +79,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
+
 import static org.onlab.util.Tools.groupedThreads;
 
 @Component(immediate = true)
@@ -115,12 +116,6 @@
     protected ExecutorService executorMsgs =
         Executors.newFixedThreadPool(32, groupedThreads("onos/of", "event-stats-%d", log));
 
-    protected ExecutorService executorPacketIn =
-        Executors.newCachedThreadPool(groupedThreads("onos/of", "event-pkt-in-stats-%d", log));
-
-    protected ExecutorService executorFlowRemoved =
-        Executors.newCachedThreadPool(groupedThreads("onos/of", "event-flow-removed-stats-%d", log));
-
     private final ExecutorService executorBarrier =
         Executors.newFixedThreadPool(4, groupedThreads("onos/of", "event-barrier-%d", log));
 
@@ -286,19 +281,11 @@
             for (PacketListener p : ofPacketListener.values()) {
                 p.handlePacket(pktCtx);
             }
-            if (monitorAllEvents) {
-                executorPacketIn.execute(new OFMessageHandler(dpid, msg));
-            }
             break;
         // TODO: Consider using separate threadpool for sensitive messages.
         //    ie. Back to back error could cause us to starve.
         case FLOW_REMOVED:
-            if (monitorAllEvents) {
-                executorFlowRemoved.execute(new OFMessageHandler(dpid, msg));
-            }
-            break;
         case ERROR:
-            log.debug("Received error message from {}: {}", dpid, msg);
             executorMsgs.execute(new OFMessageHandler(dpid, msg));
             break;
         case STATS_REPLY:
@@ -648,7 +635,7 @@
     }
 
     /**
-     * OpenFlow message handler for incoming control messages.
+     * OpenFlow message handler.
      */
     protected final class OFMessageHandler implements Runnable {