240
一线老司机
摘要: ThreadLocal提供了线程安全的数据存储和访问方式,利用不带key的get和set方法,居然能做到线程之间隔离,非常神奇。 比如 in thread 1 in thread 2 不论thread1和thread2是不是同时执行,都不会有线程安全问题,我们来测试一下。 线程安全测试 开10个线程 阅读全文
posted @ 2019-11-23 15:51 明年我18 阅读(593) 评论(0) 推荐(0) 编辑