Skip to content

arthas‐attach

hengyunabc edited this page Nov 23, 2025 · 1 revision
sequenceDiagram
    participant User as 用户 (Terminal)
    participant Boot as arthas-boot.jar
    participant JVM as 目标 JVM (PID)
    participant Agent as arthas-agent.jar
    participant Server as Arthas Server

    User->>Boot: java -jar arthas-boot.jar
    Boot->>Boot: 列出所有 Java 进程 (JPS)
    User->>Boot: 选择目标 PID
    Boot->>JVM: VirtualMachine.attach(PID)
    Note right of Boot: 使用 Java Attach API
    Boot->>JVM: loadAgent("arthas-agent.jar")
    
    JVM->>Agent: agentmain() 方法触发
    Agent->>Agent: 初始化 ArthasClassLoader (隔离环境)
    Agent->>Server: 启动 Netty 服务 (Port 3658)
    
    Server-->>User: 连接成功,显示 Arthas Logo
    Note over User, Server: 建立 Telnet 连接
Loading

Clone this wiki locally