package com.cisco.trex.stl.gui.services;

import javafx.concurrent.ScheduledService;
import javafx.concurrent.Task;

import org.apache.log4j.Logger;

import com.cisco.trex.stateless.model.stats.Utilization;

import com.exalttech.trex.core.ConnectionManager;
import com.exalttech.trex.core.RPCCommands;


public class UtilizationService extends ScheduledService<Utilization> {
    private static Logger LOG = Logger.getLogger(UtilizationService.class);

    @Override
    protected Task<Utilization> createTask() {
        return new Task<Utilization>() {
            @Override
            protected Utilization call() {
                // TODO: remove when ConnectionManager.isConnected will be returns valid result
                if (ConnectionManager.getInstance().getApiH() == null) {
                    return null;
                }

                try {
                    return RPCCommands.getUtilization();
                } catch (Exception exc) {
                    LOG.error("Failed to get utilization", exc);
                }
                return null;
            }
        };
    }
}

@@ -35,16 +35,117 @@
 vices;%0A%0A
+import com.cisco.trex.stateless.model.stats.Utilization;%0Aimport com.exalttech.trex.core.RPCCommands;%0A
 import j
@@ -179,16 +179,16 @@
 ervice;%0A
-
 import j
@@ -210,17 +210,16 @@
 t.Task;%0A
-%0A
 import o
@@ -247,161 +247,8 @@
 r;%0A%0A
-import com.cisco.trex.stateless.model.stats.Utilization;%0A%0Aimport com.exalttech.trex.core.ConnectionManager;%0Aimport com.exalttech.trex.core.RPCCommands;%0A%0A
 %0Apub
@@ -513,24 +513,24 @@
   @Override%0A
+
             
@@ -564,229 +564,8 @@
 ) %7B%0A
-                // TODO: remove when ConnectionManager.isConnected will be returns valid result%0A                if (ConnectionManager.getInstance().getApiH() == null) %7B%0A                    return null;%0A                %7D%0A%0A
     

Remove useless development stub