在带IO(Netty)的场景下,基于本项目有没有什么好的办法能做到跨线程传递对象?

Author: hu-chiaCreated Jan 4, 2021Updated Feb 25, 2026
Labels❓question✨ feature🔰 first nice issue 👍📐 design discussiont:netty

其实问题比较简单,就是 像这样的异步调用是否有 除了用TtlRunnable/TtlWrappers修饰回调以外的方法,在回调和外部传递类似MDC的参数?

mermaid
sequenceDiagram
    participant u as Controller
    participant c as CompletionStage
    participant n as netty-framework
    participant r as remote

    Note over u: 这里有一个上下文对象Context
    u->>+n: query
    n-->>+r: network
    n->>-c: CompletionStage<?>
    r-->>-n: network
    n-->>c: complete
    c-->>u: thenXxxx
    Note over u: 这里需要访问上面的Context

Source: alibaba/transmittable-thread-local