Coder Social home page Coder Social logo

Comments (5)

oldratlee avatar oldratlee commented on July 26, 2024

TTL直接提供了「关闭线程池中线程inheritable能力」的功能: @songxiaosheng
getDisableInheritableThreadFactory()

不是关闭所有线程的inheritable能力。
(当然也可实现,见TransmittableThreadLocaljavadoc

非线程池中线程,inheritable能力在业务使用中应该是必要的。

from transmittable-thread-local.

songxiaosheng avatar songxiaosheng commented on July 26, 2024

感谢大佬回复,这个inheritable能力存在时候,主线程使用了ttl的threadlocal时 大量的框架层线程触发的时候也会频繁的触发childValue方法产生大量的垃圾对象,并且拷贝到子线程的数据并不会清理风险较高

from transmittable-thread-local.

songxiaosheng avatar songxiaosheng commented on July 26, 2024

是否考虑后续new Thread场景 通过agent方式修改Runnable类型为TtlRunnable类型

from transmittable-thread-local.

oldratlee avatar oldratlee commented on July 26, 2024

有必要关闭Inheritable能力么

由你应用场景、需求决定。 @songxiaosheng

TTL提供了关闭Inheritable的一些方法,具体参见TransmitableThreadLocal的JavaDoc。

如果Inheritable的「泄露」有实际影响,则做关闭操作,当然会有功能上的影响。

from transmittable-thread-local.

oldratlee avatar oldratlee commented on July 26, 2024

是否考虑后续new Thread场景 通过agent方式修改Runnable类型为TtlRunnable类型

看起来没有必要。

TTL提供了关闭Inheritable的一些方法,具体参见TransmitableThreadLocal的JavaDoc。

from transmittable-thread-local.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.