Add a set of synchronous method for control plane monitor service
Change-Id: Ib060282dfe9a302a6cf88b9679555f4a2e8127a2
diff --git a/apps/cpman/app/src/main/java/org/onosproject/cpman/gui/CpmanViewMessageHandler.java b/apps/cpman/app/src/main/java/org/onosproject/cpman/gui/CpmanViewMessageHandler.java
index 22ad36c..a5f220d 100644
--- a/apps/cpman/app/src/main/java/org/onosproject/cpman/gui/CpmanViewMessageHandler.java
+++ b/apps/cpman/app/src/main/java/org/onosproject/cpman/gui/CpmanViewMessageHandler.java
@@ -149,21 +149,15 @@
ClusterService cs, DeviceId deviceId) {
Map<ControlMetricType, Long[]> data = Maps.newHashMap();
for (ControlMetricType cmt : CONTROL_MESSAGE_METRICS) {
- ControlLoadSnapshot cls;
- try {
- cls = cpms.getLoad(cs.getLocalNode().id(),
- cmt, NUM_OF_DATA_POINTS, TimeUnit.MINUTES,
- Optional.of(deviceId)).get();
+ ControlLoadSnapshot cls = cpms.getLoadSync(cs.getLocalNode().id(),
+ cmt, NUM_OF_DATA_POINTS, TimeUnit.MINUTES, Optional.of(deviceId));
- // TODO: in some cases, the number of returned dataset is
- // less than what we expected (expected -1)
- // As a workaround, we simply fill the slot with 0 values,
- // such a bug should be fixed with updated RRD4J lib...
- data.put(cmt, ArrayUtils.toObject(fillData(cls.recent(), NUM_OF_DATA_POINTS)));
- timestamp = cls.time();
- } catch (InterruptedException | ExecutionException e) {
- log.warn(e.getMessage());
- }
+ // TODO: in some cases, the number of returned data set is
+ // less than what we expected (expected -1)
+ // As a workaround, we simply fill the slot with 0 values,
+ // such a bug should be fixed with updated RRD4J lib...
+ data.put(cmt, ArrayUtils.toObject(fillData(cls.recent(), NUM_OF_DATA_POINTS)));
+ timestamp = cls.time();
}
return data;
}