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 {
// Adds all internal listeners.
private void addListeners() {
private synchronized void addListeners() {
listenersRemoved = false;
clusterService.addListener(clusterListener);
mastershipService.addListener(mastershipListener);
......
......@@ -136,7 +136,7 @@ public class UiWebSocket
}
@Override
public void sendMessage(ObjectNode message) {
public synchronized void sendMessage(ObjectNode message) {
try {
if (connection.isOpen()) {
connection.sendMessage(message.toString());
......@@ -148,7 +148,7 @@ public class UiWebSocket
}
@Override
public void sendMessage(String type, long sid, ObjectNode payload) {
public synchronized void sendMessage(String type, long sid, ObjectNode payload) {
ObjectNode message = mapper.createObjectNode();
message.put("event", type);
if (sid > 0) {
......@@ -160,7 +160,7 @@ public class UiWebSocket
}
// Creates new message handlers.
private void createHandlers() {
private synchronized void createHandlers() {
handlers = new HashMap<>();
UiExtensionService service = directory.get(UiExtensionService.class);
service.getExtensions().forEach(ext -> {
......