Java中的ThreadLocal变量 [英] ThreadLocal variable in Java

查看:98
本文介绍了Java中的ThreadLocal变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





有人可以分享他在Java中使用ThreadLocal变量的经验,在使用它时需要注意什么,以及什么是专业人员和ThreadLocal变量的缺点。



谢谢

Hi,

Can someone share his experience with where to use ThreadLocal variable in Java, what caution has to be taken while using it and what are the pros and cons of ThreadLocal variable.

Thanks

推荐答案

谷歌可以!



快速谷歌使用您的主题复制并粘贴为搜索词提供超过200,000次点击: q = ThreadLocal的+可变+ http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=ThreadLocal +变量+ in + Java [ ^ ]



最受欢迎的解释非常好:Class ThreadLocal [ ^ ]



学习使用Google :比问这样的问题要快得多,省力也少!
Google can!

A quick google using your subject copy and pasted as the search term gave over 200,000 hits: http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=ThreadLocal+variable+in+Java[^]

The top hit explains it pretty nicely: Class ThreadLocal[^]

Learn to use Google: it is a lot faster and less effort than asking a question like this!


谢谢,我已经找到了答案并自学了,并在我的帖子中记录:

如何在Java中使用ThreadLocal变量 [ ^ ],其中我有文档方法,我曾经使SimpleDateFormat线程安全,其他是 ThreadLocal如何创建内存Java中泄漏 [ ^ ]这是关于使用它的潜在风险manged environment。
Thanks, I have found answer and learned myself and documented here on my post :
How to use ThreadLocal variable in Java[^], in which I have document approach I used to make SimpleDateFormat thread-safe and other is How ThreadLocal creates memory leak in Java[^]which is about potential risk of using it in manged environment.


这篇关于Java中的ThreadLocal变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆