Synchronizing on ReservationNode in ConcurrentHashMap.computeIfAbsent

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Synchronizing on ReservationNode in ConcurrentHashMap.computeIfAbsent

Unmesh Joshi-2
Hi,

I was browsing through the code of ConcurrentHashMap.computeIfAbsent and on line 1655, I see synchronization as following..

  Node<K,V> r = new ReservationNode<K,V>();
synchronized (r)

What is the significance of synchronizing on new object?

Thanks,
Unmesh


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Synchronizing on ReservationNode in ConcurrentHashMap.computeIfAbsent

Jason Tedor
This was discussed previously: http://cs.oswego.edu/pipermail/concurrency-interest/2016-January/014857.html

On Fri, Apr 15, 2016 at 2:22 AM Unmesh Joshi <[hidden email]> wrote:
Hi,

I was browsing through the code of ConcurrentHashMap.computeIfAbsent and on line 1655, I see synchronization as following..

  Node<K,V> r = new ReservationNode<K,V>();
synchronized (r)

What is the significance of synchronizing on new object?

Thanks,
Unmesh

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest