102

Java ThreadLocal原理分析 | EZLippi-浮生志

 6 years ago
source link: https://www.ezlippi.com/blog/2017/11/threadlocal.html?
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
大家或多或少听说过ThreadLocal这个词,我们创建的对象默认是所有线程可以访问的,多线程并发修改对象时就会可能出现数据不一致的问题,使用ThreadLocal创建的对象只能被当前线程访问,每个线程保存一个对象的副本,在多线程操作时是线程安全的。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK