From 5e7a880091aeb63badcde3eeec3bc910840a2960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Mon, 22 Nov 2021 21:47:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B6=85=E6=97=B6=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BatchTest.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/BatchTest.java b/src/BatchTest.java index 9744884..99accdc 100644 --- a/src/BatchTest.java +++ b/src/BatchTest.java @@ -4,6 +4,7 @@ import com.alibaba.excel.util.StringUtils; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.fastjson.JSONObject; import org.apache.commons.collections4.CollectionUtils; +import org.springframework.util.StopWatch; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; @@ -20,7 +21,7 @@ import java.util.concurrent.atomic.AtomicLong; public class BatchTest { - static final String IP = "192.168.0.19:39080"; + static final String IP = "192.168.0.216:39080"; final String sourceFilePath = "D:\\goojia\\批量测试10万.xlsx"; final String aimFilePath = "D:\\goojia\\批量测试10万结果.xlsx"; final int column = 2; @@ -53,6 +54,8 @@ public class BatchTest { } }); + StopWatch stopWatch = new StopWatch(); + stopWatch.start("总标准化耗时"); try { CountDownLatch latch = new CountDownLatch(set.size()); RestTemplate restTemplate = new RestTemplate(); @@ -109,14 +112,17 @@ public class BatchTest { count.incrementAndGet(); synchronized (this) { if (count.longValue() % 1000 == 0) { - System.out.println("已标准化处理" + count.longValue() + "条地址"); + stopWatch.stop(); + System.out.println("已标准化处理" + count.longValue() + "条地址, 耗时:" + stopWatch.getTotalTimeMillis()); + stopWatch.start(); } } } }); } latch.await(); - System.out.println("已完成该批次地址标准化"); + stopWatch.stop(); + System.out.println("已完成该批次地址标准化,耗时" + stopWatch.getTotalTimeMillis()); for (List data : dataList) { String address = "";