/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.naoth.rc;

import de.naoth.rc.server.MessageServer;
import net.xeoh.plugins.base.Plugin;
import net.xeoh.plugins.base.annotations.PluginImplementation;
import net.xeoh.plugins.base.annotations.Timer;
import net.xeoh.plugins.base.annotations.injections.InjectPlugin;

/**
 *
 * @author thomas
 */
@PluginImplementation
public class ByteRateCheck implements Plugin
{

  @InjectPlugin
  public RobotControl robotControl;
  @InjectPlugin
  public ByteRateUpdateHandler updateHandler;

  long oldRecivedSize = 0;
  long oldSentSize = 0;
  long oldLoopCount = 0;

  @Timer(period=1000)
  public void updateByteRateLabels()
  {
    if(updateHandler != null && robotControl != null && robotControl.getMessageServer() != null)
    {
      MessageServer server = robotControl.getMessageServer();

      double receivedKB = ((double)(server.getReceivedBytes()-oldRecivedSize))/1024.0;
      double sentKB = ((double)(server.getSentBytes()-oldSentSize))/1024.0;
      double fps = ((double)(server.getLoopCount()-oldLoopCount));
      
      oldRecivedSize = server.getReceivedBytes();
      oldSentSize = server.getSentBytes();
      oldLoopCount = server.getLoopCount();
      
      updateHandler.setReceiveByteRate(receivedKB);
      updateHandler.setSentByteRate(sentKB);
      updateHandler.setServerLoopFPS(fps);
    }
  }

}//end ByteRateCheck

@@ -153,24 +153,59 @@
 sageServer;%0A
+import javax.swing.SwingUtilities;%0A
 import net.x
@@ -1304,24 +1304,173 @@
 t();%0A      %0A
+      if(server.isConnected()) %0A      %7B%0A        SwingUtilities.invokeLater(new Runnable() %7B%0A          @Override%0A          public void run() %7B%0A%0A      
       update
@@ -1505,24 +1505,30 @@
 eceivedKB);%0A
+      
       update
@@ -1562,24 +1562,30 @@
 tKB);%0A      
+ 
+     
 updateHandle
@@ -1609,16 +1609,70 @@
 S(fps);%0A
+          %7D%0A        %7D);%0A      %7D%0A      Thread.yield();%0A
     %7D%0A  

Make sure the ByteRateCheck is not eating up all CPU and perform GUI update in correct thread.