Registry / utility / transmittable-thread-local

transmittable-thread-local

JSON →
library2.14.5javamavenunverified

TransmittableThreadLocal enhances InheritableThreadLocal to transmit values across threads even when using thread pools, solving context propagation issues.

<dependency> <groupId>com.alibaba</groupId> <artifactId>transmittable-thread-local</artifactId> <version>2.14.5</version> </dependency>
INSTALL
IMPORT
SIG · TRANSMITTABLE-THRE
T
transmittable-thread-local
utilityjavav2.14.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TransmittableThreadLocal
✓ com.alibaba.ttl.TransmittableThreadLocal

Use TransmittableThreadLocal to propagate a value from main thread to a thread pool task.

import com.alibaba.ttl.TransmittableThreadLocal; TransmittableThreadLocal<String> context = new TransmittableThreadLocal<>(); context.set("main-thread-value"); ExecutorService executor = Executors.newFixedThreadPool(1); executor.submit(() -> { System.out.println(context.get()); // prints "main-thread-value" });
Debug
Known issues
gotchaTransmittableThreadLocal requires explicit TtlRunnable or TtlCallable wrapping for thread pools; otherwise values may not transmit.
fix
Wrap tasks with TtlRunnable.get() or use TtlExecutors.
affects: *
Upgrade
Version history
2.14.5latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
transmittable-thread-local — mvn dependency:get transmittable-thread-local · libregistry