Fix ConcurrentModificationException in UiWebSocketServlet
Change-Id: I30be9702690625d4c9113afa45f55de00a4f0886
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java
index 24e02e6..79a3ae8 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/UiWebSocketServlet.java
@@ -16,6 +16,7 @@
package org.onosproject.ui.impl;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.Sets;
import org.eclipse.jetty.websocket.WebSocket;
import org.eclipse.jetty.websocket.WebSocketServlet;
import org.onlab.osgi.DefaultServiceDirectory;
@@ -24,7 +25,6 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import java.security.Principal;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.Timer;
@@ -41,7 +41,7 @@
private ServiceDirectory directory = new DefaultServiceDirectory();
- private final Set<UiWebSocket> sockets = new HashSet<>();
+ private final Set<UiWebSocket> sockets = Sets.newConcurrentHashSet();
private final Timer timer = new Timer();
private final TimerTask pruner = new Pruner();
private boolean isStopped = false;