Redian新闻
>
HashMap entry lazy initialization in multithreaded enviroment?
avatar
HashMap entry lazy initialization in multithreaded enviroment?# Java - 爪哇娇娃
d*i
1
【 以下文字转载自 Immigration 讨论区 】
发信人: daofei (摸鱼大侠), 信区: Immigration
标 题: 请教个F1 转学的问题
发信站: BBS 未名空间站 (Mon Feb 8 20:33:55 2010, 美东)
F1 的时候申请了亲属移民,还能转学去别的学校么,身份会有问题吗?
avatar
l*n
2
看到很多作品,都是在国内DIY网站上见过哦,哈哈哈,看来手工爱好者,喜欢逛的地
方都差不多啊,哈哈
avatar
m*a
3
avatar
G*3
4
I have a problem. The entry in a hashmap has a big cost to create. So I want
to do lazy initialization. But it is in multithreaded enviroment. So I
resolve the issues like doubled checked locking and etc.
avatar
b*k
5
co-ask
avatar
B*n
6
love it!
avatar
w*z
7
take a look at guava cache.

want

【在 G****3 的大作中提到】
: I have a problem. The entry in a hashmap has a big cost to create. So I want
: to do lazy initialization. But it is in multithreaded enviroment. So I
: resolve the issues like doubled checked locking and etc.

avatar
g*g
8
ConcurrentHashMap.

want

【在 G****3 的大作中提到】
: I have a problem. The entry in a hashmap has a big cost to create. So I want
: to do lazy initialization. But it is in multithreaded enviroment. So I
: resolve the issues like doubled checked locking and etc.

avatar
G*3
9
I read the code of ConcurrentHashMap. It does work. The get(key) doesn't use
lock for most cases. But it uses volatile to guarantee it can always get
the latest value. Very sophisticated code.
Thanks for the reply!
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。