Thomas Vachuska

GUI -- Adding synchronization for message sending and for create/destroy handlers.

Change-Id: Id0cb367dcdaf658d3a58ef3f81718a08d1fd1438
...@@ -589,7 +589,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -589,7 +589,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
589 589
590 590
591 // Adds all internal listeners. 591 // Adds all internal listeners.
592 - private void addListeners() { 592 + private synchronized void addListeners() {
593 listenersRemoved = false; 593 listenersRemoved = false;
594 clusterService.addListener(clusterListener); 594 clusterService.addListener(clusterListener);
595 mastershipService.addListener(mastershipListener); 595 mastershipService.addListener(mastershipListener);
......
...@@ -136,7 +136,7 @@ public class UiWebSocket ...@@ -136,7 +136,7 @@ public class UiWebSocket
136 } 136 }
137 137
138 @Override 138 @Override
139 - public void sendMessage(ObjectNode message) { 139 + public synchronized void sendMessage(ObjectNode message) {
140 try { 140 try {
141 if (connection.isOpen()) { 141 if (connection.isOpen()) {
142 connection.sendMessage(message.toString()); 142 connection.sendMessage(message.toString());
...@@ -148,7 +148,7 @@ public class UiWebSocket ...@@ -148,7 +148,7 @@ public class UiWebSocket
148 } 148 }
149 149
150 @Override 150 @Override
151 - public void sendMessage(String type, long sid, ObjectNode payload) { 151 + public synchronized void sendMessage(String type, long sid, ObjectNode payload) {
152 ObjectNode message = mapper.createObjectNode(); 152 ObjectNode message = mapper.createObjectNode();
153 message.put("event", type); 153 message.put("event", type);
154 if (sid > 0) { 154 if (sid > 0) {
...@@ -160,7 +160,7 @@ public class UiWebSocket ...@@ -160,7 +160,7 @@ public class UiWebSocket
160 } 160 }
161 161
162 // Creates new message handlers. 162 // Creates new message handlers.
163 - private void createHandlers() { 163 + private synchronized void createHandlers() {
164 handlers = new HashMap<>(); 164 handlers = new HashMap<>();
165 UiExtensionService service = directory.get(UiExtensionService.class); 165 UiExtensionService service = directory.get(UiExtensionService.class);
166 service.getExtensions().forEach(ext -> { 166 service.getExtensions().forEach(ext -> {
......