changeset 1642:0d3f0fb73304

Make host-cpu tab query less data PR2148 Reviewed-by: omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2014-December/012316.html
author Jie Kang <jkang@redhat.com>
date Tue, 16 Dec 2014 16:20:05 -0500
parents 7dc6a2862f7b
children d92c80b54723
files client/core/src/main/java/com/redhat/thermostat/client/core/experimental/TimeRangeController.java host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/HostCpuView.java host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuController.java host-cpu/client-core/src/test/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuControllerTest.java host-cpu/client-swing/src/main/java/com/redhat/thermostat/host/cpu/client/swing/internal/HostCpuPanel.java host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImpl.java host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImplStatementDescriptorRegistration.java host-cpu/common/src/test/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImplStatementDescriptorRegistrationTest.java vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatController.java vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuController.java vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsController.java
diffstat 12 files changed, 120 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/client/core/src/main/java/com/redhat/thermostat/client/core/experimental/TimeRangeController.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/client/core/src/main/java/com/redhat/thermostat/client/core/experimental/TimeRangeController.java	Tue Dec 16 16:20:05 2014 -0500
@@ -37,24 +37,23 @@
 package com.redhat.thermostat.client.core.experimental;
 
 import com.redhat.thermostat.common.model.Range;
-import com.redhat.thermostat.storage.core.VmRef;
 
 import java.util.List;
 
-public class TimeRangeController <T> {
+public class TimeRangeController <T, R> {
 
     public interface SingleArgRunnable <T> {
         public void run(T arg);
     }
 
-    public interface StatsSupplier<T> {
-        public abstract List<T> getStats(VmRef ref, long since, long to);
+    public interface StatsSupplier<T, R> {
+        public abstract List<T> getStats(R ref, long since, long to);
     }
 
     private Range<Long> availableRange = new Range<>(Long.MAX_VALUE, Long.MIN_VALUE);
     private Range<Long> displayedRange = new Range<>(Long.MAX_VALUE, Long.MIN_VALUE);
 
-    public void update(Duration userDesiredDuration, Range<Long> newAvailableRange, StatsSupplier<T> dao, VmRef ref, SingleArgRunnable<T> updater) {
+    public void update(Duration userDesiredDuration, Range<Long> newAvailableRange, StatsSupplier<T, R> dao, R ref, SingleArgRunnable<T> updater) {
         long now = System.currentTimeMillis();
         long userVisibleTimeDelta = (userDesiredDuration.unit.toMillis(userDesiredDuration.value));
         Range<Long> desiredRange = new Range<>(now - userVisibleTimeDelta, now);
--- a/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/HostCpuView.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/HostCpuView.java	Tue Dec 16 16:20:05 2014 -0500
@@ -38,6 +38,7 @@
 
 import java.util.List;
 
+import com.redhat.thermostat.client.core.experimental.Duration;
 import com.redhat.thermostat.client.core.views.BasicView;
 import com.redhat.thermostat.client.core.views.UIComponent;
 import com.redhat.thermostat.shared.locale.LocalizedString;
@@ -55,5 +56,6 @@
 
     public abstract void addCpuUsageData(int cpuIndex, List<DiscreteTimeData<Double>> data);
 
+    public abstract Duration getUserDesiredDuration();
 }
 
--- a/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuController.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuController.java	Tue Dec 16 16:20:05 2014 -0500
@@ -41,6 +41,8 @@
 import java.util.concurrent.TimeUnit;
 
 import com.redhat.thermostat.client.core.controllers.InformationServiceController;
+import com.redhat.thermostat.client.core.experimental.Duration;
+import com.redhat.thermostat.client.core.experimental.TimeRangeController;
 import com.redhat.thermostat.client.core.views.BasicView.Action;
 import com.redhat.thermostat.client.core.views.UIComponent;
 import com.redhat.thermostat.common.ActionEvent;
@@ -49,6 +51,7 @@
 import com.redhat.thermostat.common.NotImplementedException;
 import com.redhat.thermostat.common.Timer;
 import com.redhat.thermostat.common.Timer.SchedulingType;
+import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.host.cpu.client.core.HostCpuView;
 import com.redhat.thermostat.host.cpu.client.core.HostCpuViewProvider;
 import com.redhat.thermostat.host.cpu.client.locale.LocaleResources;
@@ -73,7 +76,8 @@
     private final HostRef ref;
 
     private int chartsAdded = 0;
-    private long lastSeenTimeStamp = Long.MIN_VALUE;
+
+    private TimeRangeController<CpuStat, HostRef> timeRangeController;
 
     public HostCpuController(ApplicationService appSvc, HostInfoDAO hostInfoDao, CpuStatDAO cpuStatDAO, HostRef ref, HostCpuViewProvider provider) {
         this.ref = ref;
@@ -112,6 +116,7 @@
             }
         });
 
+        timeRangeController = new TimeRangeController<>();
     }
 
     // TODO: Consider doing this in a background thread (move to view and use SwingWorker or such).
@@ -133,16 +138,38 @@
     }
 
     private void doCpuChartUpdate() {
-        List<CpuStat> cpuStats = cpuStatDAO.getLatestCpuStats(ref, lastSeenTimeStamp);
+        CpuStat oldest = cpuStatDAO.getOldest(ref);
+        CpuStat latest = cpuStatDAO.getLatest(ref);
+
+        final List<CpuStat> cpuStats = new ArrayList<>();
+
+        Range<Long> newAvailableRange = new Range<>(oldest.getTimeStamp(), latest.getTimeStamp());
+
+        TimeRangeController.StatsSupplier<CpuStat, HostRef> statsSupplier = new TimeRangeController.StatsSupplier<CpuStat, HostRef>() {
+            @Override
+            public List<CpuStat> getStats(HostRef ref, long since, long to) {
+                return cpuStatDAO.getCpuStats(ref, since, to);
+            }
+        };
+
+        TimeRangeController.SingleArgRunnable<CpuStat> statCollector = new TimeRangeController.SingleArgRunnable<CpuStat>() {
+            @Override
+            public void run(CpuStat arg) {
+                cpuStats.add(arg);
+            }
+        };
+
         List<List<DiscreteTimeData<Double>>> results = new ArrayList<>();
+
+        timeRangeController.update(view.getUserDesiredDuration(), newAvailableRange, statsSupplier, ref, statCollector);
+
         for (CpuStat stat : cpuStats) {
             double[] data = stat.getPerProcessorUsage();
             for (int i = 0 ; i < data.length; i++) {
                 if (results.size() == i) {
                     results.add(new ArrayList<DiscreteTimeData<Double>>());
                 }
-                results.get(i).add(new DiscreteTimeData<Double>(stat.getTimeStamp(), data[i]));
-                lastSeenTimeStamp = Math.max(lastSeenTimeStamp, stat.getTimeStamp());
+                results.get(i).add(new DiscreteTimeData<>(stat.getTimeStamp(), data[i]));
             }
         }
 
--- a/host-cpu/client-core/src/test/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuControllerTest.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/client-core/src/test/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuControllerTest.java	Tue Dec 16 16:20:05 2014 -0500
@@ -56,6 +56,7 @@
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
+import com.redhat.thermostat.client.core.experimental.Duration;
 import com.redhat.thermostat.common.ActionEvent;
 import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.ApplicationService;
@@ -64,7 +65,6 @@
 import com.redhat.thermostat.common.TimerFactory;
 import com.redhat.thermostat.host.cpu.client.core.HostCpuView;
 import com.redhat.thermostat.host.cpu.client.core.HostCpuViewProvider;
-import com.redhat.thermostat.host.cpu.client.core.internal.HostCpuController;
 import com.redhat.thermostat.host.cpu.common.CpuStatDAO;
 import com.redhat.thermostat.host.cpu.common.model.CpuStat;
 import com.redhat.thermostat.shared.locale.LocalizedString;
@@ -106,10 +106,16 @@
         CpuStat cpuStat1 = new CpuStat("foo", 1l, new double[] {10.0, 20.0, 30.0});
         CpuStat cpuStat2 = new CpuStat("foo", 2l, new double[] {15.0, 25.0, 35.0});
         CpuStatDAO cpuStatDAO = mock(CpuStatDAO.class);
-        when(cpuStatDAO.getLatestCpuStats(any(HostRef.class), anyLong())).thenReturn(Arrays.asList(cpuStat1, cpuStat2));
+
+        when(cpuStatDAO.getOldest(any(HostRef.class))).thenReturn(cpuStat1);
+        when(cpuStatDAO.getLatest(any(HostRef.class))).thenReturn(cpuStat2);
+
+        when(cpuStatDAO.getCpuStats(any(HostRef.class), anyLong(), anyLong())).thenReturn(Arrays.asList(cpuStat1, cpuStat2));
 
         // Set up View
         view = mock(HostCpuView.class);
+        when(view.getUserDesiredDuration()).thenReturn(new Duration(10, TimeUnit.MINUTES));
+
         ArgumentCaptor<ActionListener> viewArgumentCaptor = ArgumentCaptor.forClass(ActionListener.class);
         doNothing().when(view).addActionListener(viewArgumentCaptor.capture());
         HostCpuViewProvider viewProvider = mock(HostCpuViewProvider.class);
--- a/host-cpu/client-swing/src/main/java/com/redhat/thermostat/host/cpu/client/swing/internal/HostCpuPanel.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/client-swing/src/main/java/com/redhat/thermostat/host/cpu/client/swing/internal/HostCpuPanel.java	Tue Dec 16 16:20:05 2014 -0500
@@ -45,6 +45,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import javax.swing.JLabel;
 import javax.swing.JPanel;
@@ -60,6 +61,7 @@
 import org.jfree.data.time.TimeSeries;
 import org.jfree.data.time.TimeSeriesCollection;
 
+import com.redhat.thermostat.client.core.experimental.Duration;
 import com.redhat.thermostat.client.swing.SwingComponent;
 import com.redhat.thermostat.client.swing.components.LabelField;
 import com.redhat.thermostat.client.swing.components.RecentTimeSeriesChartPanel;
@@ -90,6 +92,8 @@
     private final Map<String, Color> colors = new HashMap<>();
     private final Map<String, JLabel> labels = new HashMap<>();
 
+    private RecentTimeSeriesChartController chartController;
+
     private JFreeChart chart;
 
     private JPanel legendPanel;
@@ -174,6 +178,14 @@
     }
 
     @Override
+    public Duration getUserDesiredDuration() {
+        if (chartController == null) {
+            return new Duration(10, TimeUnit.MINUTES);
+        }
+        return new Duration(chartController.getTimeValue(), chartController.getTimeUnit());
+    }
+
+    @Override
     public void clearCpuUsageData() {
         SwingUtilities.invokeLater(new Runnable() {
             @Override
@@ -217,7 +229,8 @@
         chart.getPlot().setBackgroundImageAlpha(0.0f);
         chart.getPlot().setOutlinePaint(new Color(0,0,0,0));
 
-        JPanel chartPanel = new RecentTimeSeriesChartPanel(new RecentTimeSeriesChartController(chart));
+        chartController = new RecentTimeSeriesChartController(chart);
+        JPanel chartPanel = new RecentTimeSeriesChartPanel(chartController);
         chartPanel.setOpaque(false);
 
         legendPanel = new JPanel(new WrapLayout(FlowLayout.LEADING));
--- a/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java	Tue Dec 16 16:20:05 2014 -0500
@@ -43,6 +43,7 @@
 import com.redhat.thermostat.host.cpu.common.model.CpuStat;
 import com.redhat.thermostat.storage.core.HostRef;
 import com.redhat.thermostat.storage.core.Category;
+import com.redhat.thermostat.storage.core.HostTimeIntervalPojoListGetter;
 import com.redhat.thermostat.storage.core.Key;
 
 @Service
@@ -57,5 +58,11 @@
 
     void putCpuStat(CpuStat stat);
 
+    List<CpuStat> getCpuStats(HostRef ref, long since, long to);
+
+    CpuStat getOldest(HostRef ref);
+
+    CpuStat getLatest(HostRef ref);
+
 }
 
--- a/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImpl.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImpl.java	Tue Dec 16 16:20:05 2014 -0500
@@ -43,9 +43,12 @@
 import com.redhat.thermostat.common.utils.LoggingUtils;
 import com.redhat.thermostat.host.cpu.common.CpuStatDAO;
 import com.redhat.thermostat.host.cpu.common.model.CpuStat;
+import com.redhat.thermostat.storage.core.Cursor;
 import com.redhat.thermostat.storage.core.DescriptorParsingException;
+import com.redhat.thermostat.storage.core.HostBoundaryPojoGetter;
 import com.redhat.thermostat.storage.core.HostLatestPojoListGetter;
 import com.redhat.thermostat.storage.core.HostRef;
+import com.redhat.thermostat.storage.core.HostTimeIntervalPojoListGetter;
 import com.redhat.thermostat.storage.core.Key;
 import com.redhat.thermostat.storage.core.PreparedStatement;
 import com.redhat.thermostat.storage.core.StatementDescriptor;
@@ -62,20 +65,24 @@
                            " SET '" + Key.AGENT_ID.getName() + "' = ?s , " +
                                 "'" + cpuLoadKey.getName() + "' = ?d[ , " +
                                 "'" + Key.TIMESTAMP.getName() + "' = ?l";
-    
+
     private final Storage storage;
 
-    private final HostLatestPojoListGetter<CpuStat> getter;
+    private final HostLatestPojoListGetter<CpuStat> latestGetter;
+    private final HostTimeIntervalPojoListGetter<CpuStat> intervalGetter;
+    private final HostBoundaryPojoGetter<CpuStat> boundaryGetter;
 
     CpuStatDAOImpl(Storage storage) {
         this.storage = storage;
         storage.registerCategory(cpuStatCategory);
-        this.getter = new HostLatestPojoListGetter<>(storage, cpuStatCategory);
+        this.latestGetter = new HostLatestPojoListGetter<>(storage, cpuStatCategory);
+        this.intervalGetter = new HostTimeIntervalPojoListGetter<>(storage, cpuStatCategory);
+        this.boundaryGetter = new HostBoundaryPojoGetter<>(storage, cpuStatCategory);
     }
 
     @Override
     public List<CpuStat> getLatestCpuStats(HostRef ref, long lastTimeStamp) {
-        return getter.getLatest(ref, lastTimeStamp);
+        return latestGetter.getLatest(ref, lastTimeStamp);
     }
 
     @Override
@@ -94,5 +101,20 @@
             logger.log(Level.SEVERE, "Executing stmt '" + desc + "' failed!", e);
         }
     }
+
+    @Override
+    public List<CpuStat> getCpuStats(HostRef ref, long since, long to) {
+        return intervalGetter.getLatest(ref, since, to);
+    }
+
+    @Override
+    public CpuStat getOldest(HostRef ref) {
+        return boundaryGetter.getOldestStat(ref);
+    }
+
+    @Override
+    public CpuStat getLatest(HostRef ref) {
+        return boundaryGetter.getLatestStat(ref);
+    }
 }
 
--- a/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImplStatementDescriptorRegistration.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImplStatementDescriptorRegistration.java	Tue Dec 16 16:20:05 2014 -0500
@@ -40,7 +40,9 @@
 import java.util.Set;
 
 import com.redhat.thermostat.host.cpu.common.CpuStatDAO;
+import com.redhat.thermostat.storage.core.HostBoundaryPojoGetter;
 import com.redhat.thermostat.storage.core.HostLatestPojoListGetter;
+import com.redhat.thermostat.storage.core.HostTimeIntervalPojoListGetter;
 import com.redhat.thermostat.storage.core.PreparedParameter;
 import com.redhat.thermostat.storage.core.auth.DescriptorMetadata;
 import com.redhat.thermostat.storage.core.auth.StatementDescriptorRegistration;
@@ -53,15 +55,26 @@
 public class CpuStatDAOImplStatementDescriptorRegistration implements
         StatementDescriptorRegistration {
     
-    static final String DESCRIPTOR = String.format(
+    static final String LATEST = String.format(
             HostLatestPojoListGetter.HOST_LATEST_QUERY_FORMAT,
             CpuStatDAO.cpuStatCategory.getName());
-
+    static final String RANGE = String.format(
+            HostTimeIntervalPojoListGetter.HOST_INTERVAL_QUERY_FORMAT,
+            CpuStatDAO.cpuStatCategory.getName());
+    static final String LATEST_STAT = String.format(
+            HostBoundaryPojoGetter.DESC_LATEST_HOST_STAT,
+            CpuStatDAO.cpuStatCategory.getName());
+    static final String OLDEST_STAT = String.format(
+            HostBoundaryPojoGetter.DESC_OLDEST_HOST_STAT,
+            CpuStatDAO.cpuStatCategory.getName());
     @Override
     public Set<String> getStatementDescriptors() {
-        Set<String> descs = new HashSet<>(1);
-        descs.add(DESCRIPTOR);
+        Set<String> descs = new HashSet<>(5);
+        descs.add(LATEST);
+        descs.add(RANGE);
         descs.add(CpuStatDAOImpl.DESC_ADD_CPU_STAT);
+        descs.add(LATEST_STAT);
+        descs.add(OLDEST_STAT);
         return descs;
     }
 
--- a/host-cpu/common/src/test/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImplStatementDescriptorRegistrationTest.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/host-cpu/common/src/test/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImplStatementDescriptorRegistrationTest.java	Tue Dec 16 16:20:05 2014 -0500
@@ -58,7 +58,7 @@
     public void registersAllDescriptors() {
         CpuStatDAOImplStatementDescriptorRegistration reg = new CpuStatDAOImplStatementDescriptorRegistration();
         Set<String> descriptors = reg.getStatementDescriptors();
-        assertEquals(2, descriptors.size());
+        assertEquals(5, descriptors.size());
         assertFalse("null descriptor not allowed", descriptors.contains(null));
     }
     
@@ -86,7 +86,7 @@
         // storage-core + this module
         assertEquals(2, registrations.size());
         assertNotNull(cpuStatReg);
-        assertEquals(2, cpuStatReg.getStatementDescriptors().size());
+        assertEquals(5, cpuStatReg.getStatementDescriptors().size());
     }
 
 }
--- a/vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatController.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatController.java	Tue Dec 16 16:20:05 2014 -0500
@@ -54,6 +54,7 @@
 import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.shared.locale.LocalizedString;
 import com.redhat.thermostat.shared.locale.Translate;
+import com.redhat.thermostat.storage.core.Ref;
 import com.redhat.thermostat.storage.core.VmRef;
 import com.redhat.thermostat.storage.model.DiscreteTimeData;
 import com.redhat.thermostat.vm.classstat.client.core.VmClassStatView;
@@ -66,7 +67,7 @@
 
     private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
 
-    private TimeRangeController<VmClassStat> timeRangeController;
+    private TimeRangeController<VmClassStat, VmRef> timeRangeController;
 
     private class UpdateChartData implements Runnable {
         @Override
@@ -78,7 +79,7 @@
 
             Range<Long> newAvailableRange = new Range<>(oldest.getTimeStamp(), latest.getTimeStamp());
 
-            TimeRangeController.StatsSupplier<VmClassStat> singleValueSupplier = new TimeRangeController.StatsSupplier() {
+            TimeRangeController.StatsSupplier<VmClassStat, VmRef> singleValueSupplier = new TimeRangeController.StatsSupplier<VmClassStat, VmRef>() {
                 @Override
                 public List<VmClassStat> getStats(final VmRef ref, final long since, final long to) {
                     return dao.getClassStats(ref, since, to);
--- a/vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuController.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuController.java	Tue Dec 16 16:20:05 2014 -0500
@@ -54,6 +54,7 @@
 import com.redhat.thermostat.common.model.Range;
 import com.redhat.thermostat.shared.locale.LocalizedString;
 import com.redhat.thermostat.shared.locale.Translate;
+import com.redhat.thermostat.storage.core.Ref;
 import com.redhat.thermostat.storage.core.VmRef;
 import com.redhat.thermostat.storage.model.DiscreteTimeData;
 import com.redhat.thermostat.vm.cpu.client.core.VmCpuView;
@@ -75,7 +76,7 @@
 
     private Duration userDesiredDuration;
 
-    private TimeRangeController<VmCpuStat> timeRangeController;
+    private TimeRangeController<VmCpuStat, VmRef> timeRangeController;
 
     public VmCpuController(ApplicationService appSvc, VmCpuStatDAO vmCpuStatDao, VmRef ref, VmCpuViewProvider provider) {
         this.ref = ref;
@@ -144,7 +145,7 @@
 
         Range<Long> newAvailableRange = new Range<>(oldest.getTimeStamp(), latest.getTimeStamp());
 
-        TimeRangeController.StatsSupplier<VmCpuStat> singleValueSupplier = new TimeRangeController.StatsSupplier<VmCpuStat>() {
+        TimeRangeController.StatsSupplier<VmCpuStat, VmRef> singleValueSupplier = new TimeRangeController.StatsSupplier<VmCpuStat, VmRef>() {
             @Override
             public List<VmCpuStat> getStats(final VmRef ref, final long since, final long to) {
                 return dao.getVmCpuStats(ref, since, to);
--- a/vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsController.java	Tue Dec 16 16:00:40 2014 -0500
+++ b/vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsController.java	Tue Dec 16 16:20:05 2014 -0500
@@ -62,6 +62,7 @@
 import com.redhat.thermostat.gc.remote.common.command.GCAction;
 import com.redhat.thermostat.shared.locale.LocalizedString;
 import com.redhat.thermostat.shared.locale.Translate;
+import com.redhat.thermostat.storage.core.Ref;
 import com.redhat.thermostat.storage.core.VmRef;
 import com.redhat.thermostat.storage.dao.AgentInfoDAO;
 import com.redhat.thermostat.storage.dao.VmInfoDAO;
@@ -92,7 +93,7 @@
 
     private Duration userDesiredDuration = new Duration(defaultDuration.value, defaultDuration.unit);
 
-    private TimeRangeController<VmMemoryStat> timeRangeController;
+    private TimeRangeController<VmMemoryStat, VmRef> timeRangeController;
     
     class VMCollector implements Runnable {
 
@@ -107,7 +108,7 @@
 
             timeRangeController = new TimeRangeController<>();
 
-            TimeRangeController.StatsSupplier<VmMemoryStat> statsSupplier = new TimeRangeController.StatsSupplier<VmMemoryStat>() {
+            TimeRangeController.StatsSupplier<VmMemoryStat, VmRef> statsSupplier = new TimeRangeController.StatsSupplier<VmMemoryStat, VmRef>() {
                 @Override
                 public List<VmMemoryStat> getStats(VmRef ref, long since, long to) {
                     return vmDao.getVmMemoryStats(ref, since, to);