transmittable-thread-local
transmittable-thread-local copied to clipboard
📌 a missing Java std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
- 不想使用启动参数`-javaagent:PremainAgent.jar` - 想在main方法里加载它
使用 spring-boot loader + fatjar 模式打包有如下优势: - 依赖无需shade,只需要打包到 BOOT-INF - 无需配置 bootstrap classpath - 依赖及不导出的类可以在独立的loader中加载,避免应用会意外访问 - 主代码中可以依赖 kotlin,简化代码并且可以对 Transformlet 提供更好的 dsl ``` ttl-fatjar.jar `-- BOOT-INF/ | `-- lib/ | `--...
建议将agent和jar分离开来,支持独立打包: 我们需要支持线程的透传,用于服务的灰度发布。服务发布的jar - agent采用的是byte- buddy工具实现。 所以希望能够支持byte-buddy的agent。
## related resource - [Work with ThreadLocal-sensitive Components #119 - Kotlin/kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines/issues/119) - [README.md of Module kotlinx-coroutines-slf4j - Kotlin/kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines/blob/master/integration/kotlinx-coroutines-slf4j/README.md) Feature and infos are provided by @rybalkinsd @driventokill . ❤️ -------------- PS:...
include but not limited to: - confirm to `Kotlin` language usage idioms - `Kotlin` coroutine integration, in the dedicated issue #118 - ... ```kt // use TTL in Kotlin like...
```java capture() --captured--> replay() --backup--> restore() | clear() --/ ``` `capture`/`replay`/`clear`/`restore` method in `Transmitter` is not type-safe(use generic type `Object`). https://github.com/alibaba/transmittable-thread-local/blob/2a7667a2f3e9c65e71bfa42074a579344f538ced/src/main/java/com/alibaba/ttl/TransmittableThreadLocal.java#L362-L370 ## improve the type safety of transmitter - the...
移除javaassit使用byte-buddy重构agent增强的功能 fix issue 226 支持重新增强已经加载过的类 只实现了基础线程的增强,扩展机制的增强与vertx还是开发中。请先review下关于线程池与ForkJoinTask的增强有没有错误
在更新ExtensionTransformlets时使用到了WeakHashMap,在并发时,WeakHashMap在扩容的时候有一定概率形成环形链表,导致死循环,CPU飙升。
according to Java Agent and Instrumentation APIs,add entry "agentmain" and "Agent-Class" config in MANIFEST
应用接口使用了`jackson`的`ObjectMapper`,其内部序列化使用了反射机制:  反射时`jvm`会创建`sun.reflect.DelegatingClassLoader`。 在流量高峰时,   大量的`sun.reflect.DelegatingClassLoader`实例涌入, 因为流量较大内存较小流量刚接进来时即发生了`gc`。  因为`gc`会把对象给清理掉,然后`get`方法内的`while`循环一直找不到`eq`的对象,循环出不来, 最终形成了死循环逐渐耗尽`CPU`。 现场最后形成这样的堆栈信息: 