This is an automated email from the ASF dual-hosted git repository. zhangliang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push: new 038ebaeb2cf Refactor ShowProcessListHandler (#34931) 038ebaeb2cf is described below commit 038ebaeb2cf1336a51ebecb198ef52e119875ff9 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Sat Mar 8 06:21:34 2025 +0800 Refactor ShowProcessListHandler (#34931) --- .../handler/global/node/ShowProcessListHandler.java | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/ShowProcessListHandler.java b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/ShowProcessListHandler.java index 39ecac4510b..986203b1b4e 100644 --- a/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/ShowProcessListHandler.java +++ b/mode/type/cluster/core/src/main/java/org/apache/shardingsphere/mode/manager/cluster/dispatch/handler/global/node/ShowProcessListHandler.java @@ -50,14 +50,18 @@ public final class ShowProcessListHandler implements GlobalDataChangedEventHandl if (!NodePathSearcher.isMatchedPath(event.getKey(), ShowProcessListTriggerNodePath.createProcessIdSearchCriteria())) { return; } - String instanceId = NodePathSearcher.find(event.getKey(), ShowProcessListTriggerNodePath.createInstanceIdSearchCriteria()).orElse(""); - String processId = NodePathSearcher.find(event.getKey(), ShowProcessListTriggerNodePath.createProcessIdSearchCriteria()).orElse(""); - if (Type.ADDED == event.getType()) { - if (instanceId.equals(contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId())) { - new ClusterProcessPersistCoordinator(contextManager.getPersistServiceFacade().getRepository()).reportLocalProcesses(instanceId, processId); - } - } else if (Type.DELETED == event.getType()) { - ProcessOperationLockRegistry.getInstance().notify(processId); + String instanceId = NodePathSearcher.get(event.getKey(), ShowProcessListTriggerNodePath.createInstanceIdSearchCriteria()); + String processId = NodePathSearcher.get(event.getKey(), ShowProcessListTriggerNodePath.createProcessIdSearchCriteria()); + switch (event.getType()) { + case ADDED: + if (instanceId.equals(contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getId())) { + new ClusterProcessPersistCoordinator(contextManager.getPersistServiceFacade().getRepository()).reportLocalProcesses(instanceId, processId); + } + break; + case DELETED: + ProcessOperationLockRegistry.getInstance().notify(processId); + break; + default: } } }