@ApiOperation("test") @PostMapping("test") @ResponseBody public String test() { int count = 200; String url = "http://localhost:8080/newrank/getNewRankCityInfo"; CountDownLatch latch = new CountDownLatch(count); for (int i = 0; i < count; i++) { int finalI = i; new Thread() { @Override public void run() { try { latch.await(); String response = HttpRequestUtil.connect(url) .header("Content-Type", "application/json") .charset("utf-8") .timeout(5000) .post() .html(); if (StringUtils.isNotBlank(response)) {BaseResponse<NewRankCityInfoResp> newRankCityInfoRespBaseResponse = JSON.parseObject(response, new TypeReference<BaseResponse<NewRankCityInfoResp>>() {});System.out.println(JSON.toJSONString(newRankCityInfoRespBaseResponse) + "ok_" + finalI); } } catch (Exception e) { } } }.start(); latch.countDown(); } return "ok"; }
组装电脑配置清单网