|
|
|
@ -2,15 +2,11 @@ package cn.hippo4j.console.controller;
|
|
|
|
|
|
|
|
|
|
import cn.hippo4j.common.constant.Constants;
|
|
|
|
|
import cn.hippo4j.common.model.InstanceInfo;
|
|
|
|
|
import cn.hippo4j.common.model.PoolBaseInfo;
|
|
|
|
|
import cn.hippo4j.common.model.PoolParameterInfo;
|
|
|
|
|
import cn.hippo4j.common.model.PoolRunStateInfo;
|
|
|
|
|
import cn.hippo4j.common.model.ThreadDetailStateInfo;
|
|
|
|
|
import cn.hippo4j.common.toolkit.JSONUtil;
|
|
|
|
|
import cn.hippo4j.common.toolkit.StringUtil;
|
|
|
|
|
import cn.hippo4j.common.web.base.Result;
|
|
|
|
|
import cn.hippo4j.common.web.base.Results;
|
|
|
|
|
import cn.hippo4j.common.web.executor.WebThreadPoolService;
|
|
|
|
|
import cn.hippo4j.config.model.CacheItem;
|
|
|
|
|
import cn.hippo4j.config.model.biz.threadpool.ThreadPoolDelReqDTO;
|
|
|
|
|
import cn.hippo4j.config.model.biz.threadpool.ThreadPoolQueryReqDTO;
|
|
|
|
@ -26,7 +22,6 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.text.StrBuilder;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
@ -35,9 +30,9 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static cn.hippo4j.common.constant.Constants.HTTP_EXECUTE_TIMEOUT;
|
|
|
|
|
import static cn.hippo4j.common.toolkit.ContentUtil.getGroupKey;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -86,43 +81,43 @@ public class ThreadPoolController {
|
|
|
|
|
|
|
|
|
|
@GetMapping("/run/state/{tpId}")
|
|
|
|
|
public Result runState(@PathVariable("tpId") String tpId,
|
|
|
|
|
@RequestParam(value = "clientAddress", required = true) String clientAddress) {
|
|
|
|
|
@RequestParam(value = "clientAddress") String clientAddress) {
|
|
|
|
|
String urlString = StrBuilder.create("http://", clientAddress, "/run/state/", tpId).toString();
|
|
|
|
|
String data = HttpUtil.get(urlString);
|
|
|
|
|
String data = HttpUtil.get(urlString, HTTP_EXECUTE_TIMEOUT);
|
|
|
|
|
Result result = JSONUtil.parseObject(data, Result.class);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/run/thread/state/{tpId}")
|
|
|
|
|
public Result runThreadState(@PathVariable("tpId") String tpId,
|
|
|
|
|
@RequestParam(value = "clientAddress", required = true) String clientAddress) {
|
|
|
|
|
@RequestParam(value = "clientAddress") String clientAddress) {
|
|
|
|
|
String urlString = StrBuilder.create("http://", clientAddress, "/run/thread/state/", tpId).toString();
|
|
|
|
|
String data = HttpUtil.get(urlString);
|
|
|
|
|
String data = HttpUtil.get(urlString, HTTP_EXECUTE_TIMEOUT);
|
|
|
|
|
Result result = JSONUtil.parseObject(data, Result.class);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/web/base/info")
|
|
|
|
|
public Result getPoolBaseState(@RequestParam(value = "clientAddress", required = true) String clientAddress) {
|
|
|
|
|
public Result getPoolBaseState(@RequestParam(value = "clientAddress") String clientAddress) {
|
|
|
|
|
String urlString = StrBuilder.create("http://", clientAddress, "/web/base/info").toString();
|
|
|
|
|
String data = HttpUtil.get(urlString);
|
|
|
|
|
String data = HttpUtil.get(urlString, HTTP_EXECUTE_TIMEOUT);
|
|
|
|
|
Result result = JSONUtil.parseObject(data, Result.class);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/web/run/state")
|
|
|
|
|
public Result getPoolRunState(@RequestParam(value = "clientAddress", required = true) String clientAddress) {
|
|
|
|
|
public Result getPoolRunState(@RequestParam(value = "clientAddress") String clientAddress) {
|
|
|
|
|
String urlString = StrBuilder.create("http://", clientAddress, "/web/run/state").toString();
|
|
|
|
|
String data = HttpUtil.get(urlString);
|
|
|
|
|
String data = HttpUtil.get(urlString, HTTP_EXECUTE_TIMEOUT);
|
|
|
|
|
Result result = JSONUtil.parseObject(data, Result.class);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/web/update/pool")
|
|
|
|
|
public Result<Void> updateWebThreadPool(@RequestParam(value = "clientAddress", required = true) String clientAddress,
|
|
|
|
|
public Result<Void> updateWebThreadPool(@RequestParam(value = "clientAddress") String clientAddress,
|
|
|
|
|
@RequestBody PoolParameterInfo poolParameterInfo) {
|
|
|
|
|
String urlString = StrBuilder.create("http://", clientAddress, "/web/update/pool").toString();
|
|
|
|
|
String data = HttpUtil.post(urlString, JSONUtil.toJSONString(poolParameterInfo));
|
|
|
|
|
String data = HttpUtil.post(urlString, JSONUtil.toJSONString(poolParameterInfo), HTTP_EXECUTE_TIMEOUT);
|
|
|
|
|
Result result = JSONUtil.parseObject(data, Result.class);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|