Use thread safe sets for listeners in OpenFlowControllerImpl

Change-Id: Ieaae89cad1d65c70afad8cde12b17282d7fe357e
diff --git a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
index b59ce18..b361478 100644
--- a/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
+++ b/openflow/ctl/src/main/java/org/onosproject/openflow/controller/impl/OpenFlowControllerImpl.java
@@ -18,7 +18,6 @@
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Multimap;
-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;
@@ -61,10 +60,10 @@
 import java.util.Collection;
 import java.util.Dictionary;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.locks.Lock;
@@ -89,19 +88,19 @@
         Executors.newFixedThreadPool(4, groupedThreads("onos/of", "event-barrier-%d"));
 
     protected ConcurrentHashMap<Dpid, OpenFlowSwitch> connectedSwitches =
-            new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
+            new ConcurrentHashMap<>();
     protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeMasterSwitches =
-            new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
+            new ConcurrentHashMap<>();
     protected ConcurrentHashMap<Dpid, OpenFlowSwitch> activeEqualSwitches =
-            new ConcurrentHashMap<Dpid, OpenFlowSwitch>();
+            new ConcurrentHashMap<>();
 
     protected OpenFlowSwitchAgent agent = new OpenFlowSwitchAgent();
-    protected Set<OpenFlowSwitchListener> ofSwitchListener = new HashSet<>();
+    protected Set<OpenFlowSwitchListener> ofSwitchListener = new CopyOnWriteArraySet<>();
 
     protected Multimap<Integer, PacketListener> ofPacketListener =
             ArrayListMultimap.create();
 
-    protected Set<OpenFlowEventListener> ofEventListener = Sets.newHashSet();
+    protected Set<OpenFlowEventListener> ofEventListener = new CopyOnWriteArraySet<>();
 
     protected Multimap<Dpid, OFFlowStatsEntry> fullFlowStats =
             ArrayListMultimap.create();