From 9987f5f7aa6a08b30b66948f1b1d5f393b27946f Mon Sep 17 00:00:00 2001 From: pengys5 <8082209@qq.com> Date: Fri, 15 Sep 2017 23:27:46 +0800 Subject: [PATCH] Fixed #418, move the operation which create instances json array outside of for each function. --- .../apm/collector/ui/service/InstanceHealthService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java b/apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java index a0434ed2a..a29e509cc 100644 --- a/apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java +++ b/apm-collector/apm-collector-ui/src/main/java/org/skywalking/apm/collector/ui/service/InstanceHealthService.java @@ -28,11 +28,12 @@ public class InstanceHealthService { IInstanceDAO instanceDAO = (IInstanceDAO)DAOContainer.INSTANCE.get(IInstanceDAO.class.getName()); List instanceList = instanceDAO.getInstances(applicationId, halfHourBeforeTimeBucket); + JsonArray instances = new JsonArray(); + response.add("instances", instances); + instanceList.forEach(instance -> { - JsonArray instances = new JsonArray(); response.addProperty("applicationCode", ApplicationCache.getForUI(applicationId)); response.addProperty("applicationId", applicationId); - response.add("instances", instances); IInstPerformanceDAO instPerformanceDAO = (IInstPerformanceDAO)DAOContainer.INSTANCE.get(IInstPerformanceDAO.class.getName()); IInstPerformanceDAO.InstPerformance performance = instPerformanceDAO.get(timeBuckets, instance.getInstanceId());