由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - HashMap entry lazy initialization in multithreaded enviroment?
相关主题
basic java questionstart up tomcat problem
The best HashMap Cache solutionanyone saw this on code?
HashMap 怎样循环用更快?JBoss UDP exception
怎么练习java multithread刚刚开始学习java,麻烦帮我看一下我哪里错了行吗?谢谢
Re: 新生上路thread safe Singleton 的几种方法?
Ant problem问个面试题, 谢谢
java dumb questionwhat is your opinion in this case?
Unix: where to execute java program?a question regarding spring collection initialization
相关话题的讨论汇总
话题: hashmap话题: enviroment话题: lazy
进入Java版参与讨论
1 (共1页)
G****3
发帖数: 11
1
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.
w**z
发帖数: 8232
2
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.

g*****g
发帖数: 34805
3
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.

G****3
发帖数: 11
4
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!
1 (共1页)
进入Java版参与讨论
相关主题
a question regarding spring collection initializationRe: 新生上路
Re: Help!!! Java in Unix. Thread. I need exit and ls concurrently runnAnt problem
Simp question on thread synchronizationjava dumb question
Follow up Re: Simp question onUnix: where to execute java program?
basic java questionstart up tomcat problem
The best HashMap Cache solutionanyone saw this on code?
HashMap 怎样循环用更快?JBoss UDP exception
怎么练习java multithread刚刚开始学习java,麻烦帮我看一下我哪里错了行吗?谢谢
相关话题的讨论汇总
话题: hashmap话题: enviroment话题: lazy