Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Apache Shardingsphere ClusterProcessPersistService Persist

From Leeroopedia


Knowledge Sources
Domains Cluster, Process_Management
Last Updated 2026-02-10 00:00 GMT

Overview

ClusterProcessPersistService implements distributed SHOW PROCESSLIST and KILL operations by persisting trigger paths across cluster nodes and collecting results.

Description

ClusterProcessPersistService implements ProcessPersistService and uses a PersistRepository for coordination. For getProcessList, it generates a unique task ID, creates trigger paths for all online instances (both JDBC and PROXY types), persists them to trigger the ShowProcessListHandler on each instance, and waits using ProcessOperationLockRegistry until all responses are collected. Results are aggregated from ProcessNodePath entries and deserialized via YamlProcessListSwapper. For killProcess, it follows a similar trigger-and-wait pattern using KillProcessTriggerNodePath. Both operations include cleanup logic to delete trigger paths if the wait does not complete.

Usage

Use this service in cluster mode to execute SHOW PROCESSLIST and KILL commands that span multiple cluster nodes. It is the cluster-mode implementation of the ProcessPersistService interface, injected via the persist service facade.

Code Reference

Source Location

Signature

@RequiredArgsConstructor
public final class ClusterProcessPersistService implements ProcessPersistService {

    public ClusterProcessPersistService(final PersistRepository repository)

    public Collection<Process> getProcessList()

    public void killProcess(final String processId)
}

Import

import org.apache.shardingsphere.mode.manager.cluster.persist.service.ClusterProcessPersistService;

I/O Contract

Inputs

Name Type Required Description
repository PersistRepository Yes Cluster persist repository for trigger path coordination
processId String Yes ID of the process to kill (for killProcess)

Outputs

Name Type Description
processList Collection<Process> Aggregated process information from all cluster nodes

Usage Examples

ClusterProcessPersistService service = new ClusterProcessPersistService(repository);

// Show all processes across the cluster
Collection<Process> processes = service.getProcessList();

// Kill a specific process across the cluster
service.killProcess("process-uuid-123");

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment