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 ShowProcessListHandler Handle

From Leeroopedia
Revision as of 14:24, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Apache_Shardingsphere_ShowProcessListHandler_Handle.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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

Overview

ShowProcessListHandler handles distributed show process list events by collecting local process information for matching cluster instances.

Description

ShowProcessListHandler implements GlobalDataChangedEventHandler and subscribes to ShowProcessListTriggerNodePath for ADDED and DELETED event types. On an ADDED event, it extracts the instance ID and process ID (task ID) from the event path. If the local instance matches, it delegates to ClusterProcessPersistCoordinator.reportLocalProcesses to persist local process information into the shared repository under the task ID. On a DELETED event, it notifies ProcessOperationLockRegistry to release any waiting locks, signaling the requesting node that process collection is complete.

Usage

This handler is auto-loaded via SPI in cluster mode. When a SHOW PROCESSLIST command is executed, trigger paths are persisted for all online instances. Each instance's handler responds by reporting its local processes, enabling the requesting node to aggregate results from all cluster members.

Code Reference

Source Location

Signature

public final class ShowProcessListHandler implements GlobalDataChangedEventHandler {

    public NodePath getSubscribedNodePath()

    public Collection<Type> getSubscribedTypes()

    public void handle(final ContextManager contextManager, final DataChangedEvent event)
}

Import

import org.apache.shardingsphere.mode.manager.cluster.dispatch.handler.global.node.process.ShowProcessListHandler;

I/O Contract

Inputs

Name Type Required Description
contextManager ContextManager Yes Provides access to instance context and persist services
event DataChangedEvent Yes Contains the event key (path), value, and type (ADDED/DELETED)

Outputs

Name Type Description
void void Side effects: reports local processes to the shared repository or notifies lock registry

Usage Examples

// Trigger show process list by persisting trigger paths for all online instances:
String triggerPath = NodePathGenerator.toPath(
    new ShowProcessListTriggerNodePath(new InstanceProcessNodeValue(instanceId, taskId)));
repository.persist(triggerPath, "");
// Each instance's ShowProcessListHandler reports its local processes under the taskId path.

Related Pages

Page Connections

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