Thomas Vachuska

GUI -- Moved more potentially expensive processing off listener dispatch thread.

Change-Id: Id5ff77ad1a4038e6840993da5cbc03a3fac944fb
...@@ -512,7 +512,6 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -512,7 +512,6 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
512 512
513 // Subscribes for summary messages. 513 // Subscribes for summary messages.
514 private synchronized void requestSummary(long sid) { 514 private synchronized void requestSummary(long sid) {
515 -
516 sendMessage(summmaryMessage(sid)); 515 sendMessage(summmaryMessage(sid));
517 } 516 }
518 517
...@@ -754,9 +753,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -754,9 +753,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
754 private class InternalClusterListener implements ClusterEventListener { 753 private class InternalClusterListener implements ClusterEventListener {
755 @Override 754 @Override
756 public void event(ClusterEvent event) { 755 public void event(ClusterEvent event) {
757 - msgSender.execute(() -> { 756 + msgSender.execute(() -> sendMessage(instanceMessage(event, null)));
758 - sendMessage(instanceMessage(event, null));
759 - });
760 } 757 }
761 } 758 }
762 759
...@@ -779,9 +776,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -779,9 +776,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
779 @Override 776 @Override
780 public void event(DeviceEvent event) { 777 public void event(DeviceEvent event) {
781 if (event.type() != PORT_STATS_UPDATED) { 778 if (event.type() != PORT_STATS_UPDATED) {
782 - msgSender.execute(() -> { 779 + msgSender.execute(() -> sendMessage(deviceMessage(event)));
783 - sendMessage(deviceMessage(event));
784 - });
785 eventAccummulator.add(event); 780 eventAccummulator.add(event);
786 } 781 }
787 } 782 }
...@@ -791,9 +786,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -791,9 +786,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
791 private class InternalLinkListener implements LinkListener { 786 private class InternalLinkListener implements LinkListener {
792 @Override 787 @Override
793 public void event(LinkEvent event) { 788 public void event(LinkEvent event) {
794 - msgSender.execute(() -> { 789 + msgSender.execute(() -> sendMessage(linkMessage(event)));
795 - sendMessage(linkMessage(event));
796 - });
797 eventAccummulator.add(event); 790 eventAccummulator.add(event);
798 } 791 }
799 } 792 }
...@@ -802,9 +795,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -802,9 +795,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
802 private class InternalHostListener implements HostListener { 795 private class InternalHostListener implements HostListener {
803 @Override 796 @Override
804 public void event(HostEvent event) { 797 public void event(HostEvent event) {
805 - msgSender.execute(() -> { 798 + msgSender.execute(() -> sendMessage(hostMessage(event)));
806 - sendMessage(hostMessage(event));
807 - });
808 eventAccummulator.add(event); 799 eventAccummulator.add(event);
809 } 800 }
810 } 801 }
...@@ -830,7 +821,9 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -830,7 +821,9 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
830 821
831 // encapsulate 822 // encapsulate
832 private static class TrafficEvent { 823 private static class TrafficEvent {
833 - enum Type { ALL_TRAFFIC, DEV_LINK_FLOWS, SEL_INTENT } 824 + enum Type {
825 + ALL_TRAFFIC, DEV_LINK_FLOWS, SEL_INTENT
826 + }
834 827
835 private final Type type; 828 private final Type type;
836 private final ObjectNode payload; 829 private final ObjectNode payload;
...@@ -875,7 +868,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -875,7 +868,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
875 public void run() { 868 public void run() {
876 try { 869 try {
877 if (summaryRunning) { 870 if (summaryRunning) {
878 - requestSummary(0); 871 + msgSender.execute(() -> requestSummary(0));
879 } 872 }
880 } catch (Exception e) { 873 } catch (Exception e) {
881 log.warn("Unable to handle summary request due to {}", e.getMessage()); 874 log.warn("Unable to handle summary request due to {}", e.getMessage());
...@@ -894,7 +887,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -894,7 +887,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
894 public void processItems(List<Event> items) { 887 public void processItems(List<Event> items) {
895 try { 888 try {
896 if (summaryRunning) { 889 if (summaryRunning) {
897 - requestSummary(0); 890 + msgSender.execute(() -> requestSummary(0));
898 } 891 }
899 } catch (Exception e) { 892 } catch (Exception e) {
900 log.warn("Unable to handle summary request due to {}", e.getMessage()); 893 log.warn("Unable to handle summary request due to {}", e.getMessage());
......