- 浏览: 712 次
- 性别:
- 来自: 武汉
最新评论
文章列表
private Map<Integer, Object> map = new ConcurrentHashMap<Integer, Object> ();
@unsafe
public void putIfAbsent(Integer key, String value){
if (!map.containsKey(key)) { map.put(key, value); }
}
-------------------------------------------------------- ...
1. 多个线程没有协同的情况下调用getSubscribedList 是安全的吗?
最坏的情况是什么?
public List<Long> getSubscribedList(String userId) { List<Long> subscribedIds = Lists.newArrayList(); try {
//fetch from google guava cache order by subscription time desc List<SubscribeEntity ...