From 727a94e47554c9897720a01a62e129c89aac73fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Levy=2EXie-=E8=A7=A3=E5=AE=89=E6=A3=AE?= Date: Mon, 15 Jul 2024 17:26:24 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-117002=20feat:=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8UI=E6=80=A7=E8=83=BD=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/carton/CartonUtils.java | 8 ++++---- .../fr/design/carton/latency/DesignerLatencyMetric.java | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/carton/CartonUtils.java b/designer-base/src/main/java/com/fr/design/carton/CartonUtils.java index b67fe8c504..df8361662b 100644 --- a/designer-base/src/main/java/com/fr/design/carton/CartonUtils.java +++ b/designer-base/src/main/java/com/fr/design/carton/CartonUtils.java @@ -116,10 +116,10 @@ public class CartonUtils { } file.createNewFile(); } - BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file, true)); - String outputMessage = message.replaceAll("~", "\r\n") + "," + "\r\n"; - bufferedWriter.write(outputMessage); - bufferedWriter.close(); + try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file, true))) { + String outputMessage = message.replaceAll("~", "\r\n") + "," + "\r\n"; + bufferedWriter.write(outputMessage); + } } catch (IOException e) { FineLoggerFactory.getLogger().error("output fail", e); } diff --git a/designer-base/src/main/java/com/fr/design/carton/latency/DesignerLatencyMetric.java b/designer-base/src/main/java/com/fr/design/carton/latency/DesignerLatencyMetric.java index d98e26c198..766ff17dba 100644 --- a/designer-base/src/main/java/com/fr/design/carton/latency/DesignerLatencyMetric.java +++ b/designer-base/src/main/java/com/fr/design/carton/latency/DesignerLatencyMetric.java @@ -92,8 +92,12 @@ public class DesignerLatencyMetric { */ public void stop() { if (SwitchForSwingChecker.isLatencyMonitoring()) { - this.executorService.shutdown(); - this.scheduler.shutdown(); + if (this.executorService != null) { + this.executorService.shutdown(); + } + if (this.scheduler != null) { + this.scheduler.shutdown(); + } collectAndSubmit(); } }