From 66b2a9bd77ea9307625b54d9435bdfdc37d35f01 Mon Sep 17 00:00:00 2001 From: liuchongrui Date: Thu, 25 Sep 2014 16:31:27 +0800 Subject: [PATCH] modify MonitorMain and MainController delete unused field and fix bug MainController --- .../bench4q/monitor/api/MainController.java | 8 +++++++- .../bench4q/monitor/model/MonitorMain.java | 19 ++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java index 4a13391f..a9385130 100644 --- a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java +++ b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/api/MainController.java @@ -1,6 +1,8 @@ package org.bench4q.monitor.api; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -42,10 +44,14 @@ public class MainController { return testPlanId.toString(); } + @RequestMapping(value = "/brief/{testPlanId}", method = RequestMethod.GET) @ResponseBody MonitorMain brief(@PathVariable UUID testPlanId) throws SigarException, InterruptedException, ExecutionException { - return new MonitorMain(this.submitedLimits.get(testPlanId)); + LimitModel limitModel = this.submitedLimits.get(testPlanId); + if (limitModel != null) + return new MonitorMain(limitModel); + else return null; } } diff --git a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/MonitorMain.java b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/MonitorMain.java index 10e0fdd7..aa80269b 100644 --- a/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/MonitorMain.java +++ b/Bench4Q-Monitor-Sigar/src/main/java/org/bench4q/monitor/model/MonitorMain.java @@ -6,8 +6,6 @@ import java.util.Date; import java.util.List; import java.util.TimeZone; import java.util.concurrent.ExecutionException; -import java.util.jar.Attributes.Name; - import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @@ -30,8 +28,6 @@ public class MonitorMain extends SampleModel { private NetworkInterfaceModel networkInterfaceModel; @XmlElement(name = "process_info") private ProcessModel processModel; - @XmlElement(name = "touch_limit") - private boolean isTouchLimit; @XmlElement(name = "reach_limit") private boolean isReachLimit; private SimpleDateFormat dateFormat = new SimpleDateFormat( @@ -85,6 +81,14 @@ public class MonitorMain extends SampleModel { System.out.println(System.currentTimeMillis() - startTime); } + public boolean getIsReachLimit() { + return isReachLimit; + } + + public void setIsReachLimit(boolean isReachLimit) { + this.isReachLimit = isReachLimit; + } + private boolean getLimitresult(LimitModel limitModel) throws SigarException { //LimitableFieldsModel limitableFieldsModel = new LimitableFieldsModel(); boolean limitResult = false; @@ -116,11 +120,4 @@ public class MonitorMain extends SampleModel { this.networkInterfaceModel = networkInterfaceModel; } - public boolean isTouchLimit() { - return isTouchLimit; - } - - public void setTouchLimit(boolean isTouchLimit) { - this.isTouchLimit = isTouchLimit; - } }