并发哈希映射获取并放置重叠

时间:2015-04-29 20:07:56

标签: concurrency concurrenthashmap thread-synchronization

我已经读过get方法在ConcurrentHashMap(Jdk 7 )中完全并发,因此它可以与所有更新操作重叠。如果Key不存在,两个线程同时运行put(Key,V)Get (Key)会发生什么?

1 个答案:

答案 0 :(得分:0)

根据JDK7 Javadoc

  

检索反映了最近完成的更新操作的结果。

这意味着如果在get()完成之前调用nullput()将返回put()

您的问题的简短回答是:null将返回$.googleAnalyticsEventTracking({ targetSelector: '#id-of-the-form', // it can be any jQuery selector events: { eventType: 'submit', gaEventData: { category: 'Form', // The same as you will set on the Goal setup action: 'Sent', // The same as you will set on the Goal setup label: 'Sign Up' // The same as you will set on the Goal setup } } });