From 5918b1b308dcbd04c5a42364e24ecfb7cdd94f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E6=B5=B7=E6=B4=8B?= Date: Fri, 10 Nov 2023 10:58:34 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84=E6=9D=83=E9=99=90=E7=A0=81=E4=B9=9F=E8=83=BD=E6=9F=A5?= =?UTF-8?q?=E5=88=B0=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TyrSaasAuthServiceImpl.java | 32 ++++--------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java index 7399d88b..1d2bd05e 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java @@ -15,25 +15,12 @@ import cn.axzo.tyr.client.model.permission.PermissionPointListQueryRequest; import cn.axzo.tyr.client.model.permission.PermissionPointTreeNode; import cn.axzo.tyr.client.model.permission.PermissionPointTreeQueryReq; import cn.axzo.tyr.client.model.product.ProductFeatureRelationVO; -import cn.axzo.tyr.client.model.req.CheckIdentityPermissionReq; -import cn.axzo.tyr.client.model.req.IdentityAuthReq; -import cn.axzo.tyr.client.model.req.ListIdentityFromPermissionReq; -import cn.axzo.tyr.client.model.req.ListPermissionFromFeatureReq; -import cn.axzo.tyr.client.model.req.ListPermissionFromIdentityReq; -import cn.axzo.tyr.client.model.req.OUWorkspacePair; -import cn.axzo.tyr.client.model.req.QuerySaasRoleReq; +import cn.axzo.tyr.client.model.req.*; import cn.axzo.tyr.client.model.res.IdentityAuthRes; import cn.axzo.tyr.client.model.res.ListIdentityFromPermissionResp; import cn.axzo.tyr.client.model.res.QueryIdentityByPermissionResp; import cn.axzo.tyr.client.model.vo.SaasRoleVO; -import cn.axzo.tyr.server.repository.entity.ProductFeatureInfo; -import cn.axzo.tyr.server.repository.entity.ProductFeatureQuery; -import cn.axzo.tyr.server.repository.entity.RolePermission; -import cn.axzo.tyr.server.repository.entity.SaasFeature; -import cn.axzo.tyr.server.repository.entity.SaasProductModuleFeatureRelation; -import cn.axzo.tyr.server.repository.entity.SaasRole; -import cn.axzo.tyr.server.repository.entity.SaasRoleUserRelation; -import cn.axzo.tyr.server.repository.entity.SaasRoleWithUser; +import cn.axzo.tyr.server.repository.entity.*; import cn.axzo.tyr.server.repository.mapper.TyrSaasAuthMapper; import cn.axzo.tyr.server.service.PermissionPointService; import cn.axzo.tyr.server.service.ProductFeatureRelationService; @@ -48,7 +35,6 @@ import cn.hutool.core.date.StopWatch; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; -import com.alibaba.fastjson.JSON; import com.google.common.collect.Lists; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -57,16 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; @@ -535,6 +512,9 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { //code查询权限点信息 List features = permissionPointService.listNodeWithChildrenByCode(req.getFeatureCode(), req.getTerminal()); + if (CollectionUtil.isEmpty(features)) { + return result; + } Set featureIds = features.stream().map(SaasFeature::getId).collect(Collectors.toSet()); log.info("------trace-L-I-F-P----> features need to check:{}", featureIds); //权限匹配 - 工作台是否有指定权限 From 66327320a9db93b325868390f4fc3891603780c0 Mon Sep 17 00:00:00 2001 From: zhansihu Date: Mon, 13 Nov 2023 11:06:27 +0800 Subject: [PATCH 2/8] =?UTF-8?q?refactor(listIdentity):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0stopwatch=EF=BC=9B=E8=B0=83=E6=95=B4=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tyr/server/config/ExecutorConfig.java | 8 +++----- .../impl/PermissionPointServiceImpl.java | 2 +- .../service/impl/TyrSaasAuthServiceImpl.java | 20 ++++++++++++++++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java index 758d0048..7bcccf63 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java @@ -24,11 +24,9 @@ public class ExecutorConfig { @Bean public ExecutorService authExecutor() { new ThreadPoolExecutor.CallerRunsPolicy(); - int coreSize = Runtime.getRuntime() - .availableProcessors() < 4 ? Runtime.getRuntime().availableProcessors() * 4 - : Runtime.getRuntime().availableProcessors(); - ThreadPoolExecutor executor = new ThreadPoolExecutor(coreSize, coreSize * 4, 60, TimeUnit.SECONDS, - new ArrayBlockingQueue<>(1), r -> new Thread(r, "TYR-AUTH-EXECUTOR"), new ThreadPoolExecutor.CallerRunsPolicy() { + int coreSize = 5; + ThreadPoolExecutor executor = new ThreadPoolExecutor(coreSize, 20, 60, TimeUnit.SECONDS, + new ArrayBlockingQueue<>(100), r -> new Thread(r, "TYR-AUTH-EXECUTOR"), new ThreadPoolExecutor.CallerRunsPolicy() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { log.warn("auth executor rejected , use caller runs"); diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/PermissionPointServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/PermissionPointServiceImpl.java index d461cbf8..2f2c660a 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/PermissionPointServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/PermissionPointServiceImpl.java @@ -568,7 +568,7 @@ public class PermissionPointServiceImpl implements PermissionPointService { List currentFeatrureList = saasFeatureDao.list(new LambdaQueryWrapper() .eq(SaasFeature::getFeatureCode, featureCode) .eq(StrUtil.isNotBlank(terminal), SaasFeature::getTerminal, terminal)); - //button过滤减少查询 + //button过滤-如果全是按钮则不查子级 Set pathsWithoutButton = currentFeatrureList.stream() .filter(f -> !BUTTON.sameCode(f.getFeatureType())) .map(SaasFeature::getPath) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java index 1d2bd05e..b7226831 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java @@ -510,15 +510,21 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { result.setOuId(req.getOuId()); result.setWorkspaceId(req.getWorkspaceId()); + StopWatch watch = StopWatch.create("listIdentityFromPermission"); //code查询权限点信息 + watch.start("listNodeWithChildrenByCode"); List features = permissionPointService.listNodeWithChildrenByCode(req.getFeatureCode(), req.getTerminal()); + watch.stop(); if (CollectionUtil.isEmpty(features)) { + log.warn("------trace-L-I-F-P----> no features found for:{}", req.getFeatureCode()); return result; } Set featureIds = features.stream().map(SaasFeature::getId).collect(Collectors.toSet()); log.info("------trace-L-I-F-P----> features need to check:{}", featureIds); //权限匹配 - 工作台是否有指定权限 + watch.start("matchWorkspaceFeature"); Set matchedFeatureIds = matchWorkspaceFeature(req.getWorkspaceId(), req.getWorkspaceJoinType(), featureIds); + watch.stop(); if (CollectionUtil.isEmpty(matchedFeatureIds)) { log.warn("------trace-L-I-F-P----> no matched feature in workspace"); return result; @@ -537,7 +543,10 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { } //从相关角色查询用户-超管和普通角色 + watch.start("getUsersFromRole"); List users = getUsersFromRole(req, matchedFeatureIds); + watch.stop(); + watch.prettyPrint(TimeUnit.MILLISECONDS); result.setUsers(users); return result; } @@ -565,9 +574,11 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { private List getUsersFromRole(ListIdentityFromPermissionReq req, Set featureIds) { Long ouId = req.getOuId(); Long workspaceId = req.getWorkspaceId(); - + StopWatch watch = StopWatch.create("getUsersFromRole"); //查询OU-工作台下的角色-含superAdmin + watch.start("listForOUWorkspace"); List roleList = roleService.listForOUWorkspace(ouId, workspaceId, req.getWorkspaceJoinType()); + watch.stop(); List roleIds = roleList.stream().map(SaasRole::getId).collect(Collectors.toList()); log.info("------trace-L-I-F-P----> roles from ou-workspace:{}", roleIds); if (CollectionUtil.isEmpty(roleList)) { @@ -576,9 +587,12 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { } //查询角色及权限 + watch.start("roleService.getByIds"); List rolePermissions = roleService.getByIds(roleIds, null, Lists.newArrayList(workspaceId), Lists.newArrayList(ouId), true); + watch.stop(); //计算角色实际的权限 - 匹配请求的权限 --> 实际拥有权限的角色 + watch.start("filterMatchFeature"); List matchedRoleList = new ArrayList<>(); for (SaasRoleVO rolePermission : rolePermissions) { List filterFeature = rolePermission.getMatchFeature(workspaceId, ouId); @@ -589,8 +603,10 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { log.info("------trace-L-I-F-P----> not matched role:{}", rolePermission.getId()); } } + watch.stop(); //查询角色下用户 + watch.start("roleUserService.listByRoleIds"); List matchedRoleIds = matchedRoleList.stream().map(SaasRoleVO::getId).collect(Collectors.toList()); //追加工作台超管 Set superAdmins = roleList @@ -606,6 +622,7 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { } List relationList = roleUserService.listByRoleIds(matchedRoleIds, ouId, workspaceId); + watch.stop(); //构建用户-去重(identityId-identityType) List users = new ArrayList<>(); Set filterSet = new HashSet<>(); @@ -618,6 +635,7 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { users.add(user); } } + watch.prettyPrint(TimeUnit.MILLISECONDS); return users; } From 390ae73f50a73c4132174c47c05f9d8a51dba201 Mon Sep 17 00:00:00 2001 From: zhansihu Date: Mon, 13 Nov 2023 13:49:19 +0800 Subject: [PATCH 3/8] =?UTF-8?q?refactor(listIdentity):=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0stopwatch=EF=BC=9B=E8=B0=83=E6=95=B4=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/axzo/tyr/server/config/ExecutorConfig.java | 4 ++-- .../tyr/server/service/impl/TyrSaasAuthServiceImpl.java | 9 ++++++++- .../java/cn/axzo/tyr/server/permission/SimpleTest.java | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java index 7bcccf63..ecda477a 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java @@ -25,8 +25,8 @@ public class ExecutorConfig { public ExecutorService authExecutor() { new ThreadPoolExecutor.CallerRunsPolicy(); int coreSize = 5; - ThreadPoolExecutor executor = new ThreadPoolExecutor(coreSize, 20, 60, TimeUnit.SECONDS, - new ArrayBlockingQueue<>(100), r -> new Thread(r, "TYR-AUTH-EXECUTOR"), new ThreadPoolExecutor.CallerRunsPolicy() { + ThreadPoolExecutor executor = new ThreadPoolExecutor(coreSize, 30, 60, TimeUnit.SECONDS, + new ArrayBlockingQueue<>(50), r -> new Thread(r, "TYR-AUTH-EXECUTOR"), new ThreadPoolExecutor.CallerRunsPolicy() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { log.warn("auth executor rejected , use caller runs"); diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java index b7226831..af03bf0d 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java @@ -642,10 +642,16 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { @Override public List batchListIdentityFromPermission(List reqList) { //异步处理 + StopWatch watch = StopWatch.create("batchListIdentityFromPermission"); List> futureList = new ArrayList<>(); for (ListIdentityFromPermissionReq req : reqList) { CompletableFuture future = CompletableFuture.supplyAsync( - () -> this.listIdentityFromPermission(req), executor); + () -> { + watch.start("batchListIdentityFromPermission-task-" + req.getFeatureCode()); + ListIdentityFromPermissionResp resp = this.listIdentityFromPermission(req); + watch.stop(); + return resp; + }, executor); futureList.add(future); } @@ -653,6 +659,7 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { for (CompletableFuture future : futureList) { result.add(future.join()); } + watch.prettyPrint(TimeUnit.MILLISECONDS); return result; } diff --git a/tyr-server/src/test/java/cn/axzo/tyr/server/permission/SimpleTest.java b/tyr-server/src/test/java/cn/axzo/tyr/server/permission/SimpleTest.java index 6f379ddc..5b27c8d6 100644 --- a/tyr-server/src/test/java/cn/axzo/tyr/server/permission/SimpleTest.java +++ b/tyr-server/src/test/java/cn/axzo/tyr/server/permission/SimpleTest.java @@ -1,8 +1,11 @@ package cn.axzo.tyr.server.permission; import cn.axzo.tyr.client.model.permission.PermissionPointVO; +import cn.hutool.core.date.StopWatch; import org.junit.Test; +import java.util.concurrent.TimeUnit; + /** * @version V1.0 * @author: ZhanSiHu From fbc10c2323c3735c6b519e154dedef003628cedd Mon Sep 17 00:00:00 2001 From: zhansihu Date: Mon, 13 Nov 2023 14:07:00 +0800 Subject: [PATCH 4/8] =?UTF-8?q?refactor(listIdentity):=20=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=88=86=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tyr/server/service/impl/TyrSaasAuthServiceImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java index af03bf0d..33d73507 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java @@ -643,22 +643,26 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { public List batchListIdentityFromPermission(List reqList) { //异步处理 StopWatch watch = StopWatch.create("batchListIdentityFromPermission"); + watch.start("addFeature"); List> futureList = new ArrayList<>(); for (ListIdentityFromPermissionReq req : reqList) { CompletableFuture future = CompletableFuture.supplyAsync( () -> { - watch.start("batchListIdentityFromPermission-task-" + req.getFeatureCode()); + long start = System.currentTimeMillis(); ListIdentityFromPermissionResp resp = this.listIdentityFromPermission(req); - watch.stop(); + log.info("------trace-B-L-I-F-P----> task cost:{}", System.currentTimeMillis() - start); return resp; }, executor); futureList.add(future); } + watch.stop(); List result = new ArrayList<>(); + watch.start("collectResult"); for (CompletableFuture future : futureList) { result.add(future.join()); } + watch.stop(); watch.prettyPrint(TimeUnit.MILLISECONDS); return result; From 54b2ecf0308a03ff1e3aa017bd18a9e4a23ea205 Mon Sep 17 00:00:00 2001 From: zhansihu Date: Mon, 13 Nov 2023 14:07:57 +0800 Subject: [PATCH 5/8] =?UTF-8?q?refactor(listIdentity):=20=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=88=86=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java index 33d73507..fbe05160 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java @@ -650,7 +650,7 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { () -> { long start = System.currentTimeMillis(); ListIdentityFromPermissionResp resp = this.listIdentityFromPermission(req); - log.info("------trace-B-L-I-F-P----> task cost:{}", System.currentTimeMillis() - start); + log.info("------trace-B-L-I-F-P----> code:{},task cost:{}", req.getFeatureCode(), System.currentTimeMillis() - start); return resp; }, executor); futureList.add(future); From a354d44b39cca1d6cef42685e0c9cbd760d7b37e Mon Sep 17 00:00:00 2001 From: zhansihu Date: Mon, 13 Nov 2023 16:13:58 +0800 Subject: [PATCH 6/8] =?UTF-8?q?refactor(listIdentity):=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E8=AE=A1=E6=97=B6=EF=BC=9Btrace=E8=B7=A8=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/TyrSaasAuthServiceImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java index fbe05160..f2490cd0 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/impl/TyrSaasAuthServiceImpl.java @@ -4,6 +4,7 @@ import cn.axzo.basics.common.BeanMapper; import cn.axzo.basics.common.util.AssertUtil; import cn.axzo.framework.domain.ServiceException; import cn.axzo.pokonyan.config.mybatisplus.BaseEntity; +import cn.axzo.pokonyan.util.TraceSupplier; import cn.axzo.thrones.client.saas.ServicePkgClient; import cn.axzo.thrones.client.saas.entity.serivicepgkproduct.ServicePkgProduct; import cn.axzo.thrones.client.saas.entity.servicepkg.ServicePkgDetailRes; @@ -643,16 +644,15 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService { public List batchListIdentityFromPermission(List reqList) { //异步处理 StopWatch watch = StopWatch.create("batchListIdentityFromPermission"); - watch.start("addFeature"); + watch.start("addFuture"); List> futureList = new ArrayList<>(); for (ListIdentityFromPermissionReq req : reqList) { - CompletableFuture future = CompletableFuture.supplyAsync( - () -> { - long start = System.currentTimeMillis(); - ListIdentityFromPermissionResp resp = this.listIdentityFromPermission(req); - log.info("------trace-B-L-I-F-P----> code:{},task cost:{}", req.getFeatureCode(), System.currentTimeMillis() - start); - return resp; - }, executor); + long start = System.currentTimeMillis(); + CompletableFuture future = CompletableFuture.supplyAsync(TraceSupplier.create(() -> { + ListIdentityFromPermissionResp resp = this.listIdentityFromPermission(req); + log.info("------trace-B-L-I-F-P----> code:{},task cost:{}", req.getFeatureCode(), System.currentTimeMillis() - start); + return resp; + }), executor); futureList.add(future); } watch.stop(); From 39a89c9f22e2554af9ec14b2c83f7daa59fbf34b Mon Sep 17 00:00:00 2001 From: zhansihu Date: Mon, 13 Nov 2023 16:29:24 +0800 Subject: [PATCH 7/8] =?UTF-8?q?refactor(listIdentity):=20=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=B1=A0=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/axzo/tyr/server/config/ExecutorConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java index ecda477a..ea3d2321 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java @@ -1,5 +1,6 @@ package cn.axzo.tyr.server.config; +import cn.hutool.core.thread.NamedThreadFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -26,7 +27,7 @@ public class ExecutorConfig { new ThreadPoolExecutor.CallerRunsPolicy(); int coreSize = 5; ThreadPoolExecutor executor = new ThreadPoolExecutor(coreSize, 30, 60, TimeUnit.SECONDS, - new ArrayBlockingQueue<>(50), r -> new Thread(r, "TYR-AUTH-EXECUTOR"), new ThreadPoolExecutor.CallerRunsPolicy() { + new ArrayBlockingQueue<>(50), new NamedThreadFactory("TYR-AUTH-EXECUTOR", false), new ThreadPoolExecutor.CallerRunsPolicy() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { log.warn("auth executor rejected , use caller runs"); From 666b9344b79e61736a8273148472fc921edf27ac Mon Sep 17 00:00:00 2001 From: zhansihu Date: Mon, 13 Nov 2023 17:08:11 +0800 Subject: [PATCH 8/8] =?UTF-8?q?refactor(listIdentity):=20=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=B1=A0=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java index ea3d2321..774b1a55 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/config/ExecutorConfig.java @@ -27,7 +27,7 @@ public class ExecutorConfig { new ThreadPoolExecutor.CallerRunsPolicy(); int coreSize = 5; ThreadPoolExecutor executor = new ThreadPoolExecutor(coreSize, 30, 60, TimeUnit.SECONDS, - new ArrayBlockingQueue<>(50), new NamedThreadFactory("TYR-AUTH-EXECUTOR", false), new ThreadPoolExecutor.CallerRunsPolicy() { + new ArrayBlockingQueue<>(50), new NamedThreadFactory("TYR-AUTH-EXECUTOR-", false), new ThreadPoolExecutor.CallerRunsPolicy() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { log.warn("auth executor rejected , use caller runs");