Is the whole method call atomic or is just the BiFunction execution atomic? Is it blocking for all keys or just for the calls on the same key?
The following details are for OpenJDK Java 11.
These three methods hold a lock on a Node
in the map while the method is called and the key / value is updated. This node will typically be the first node in a the chain or tree of nodes for a hash bucket. Concurrent attempts to insert, update or delete key/value pairs in the same bucket will be blocked until the lock is released.
(The behavior for other versions of Java could be different.)
Is the whole method call atomic or is just the BiFunction execution atomic?
The whole method call.
Is it blocking for all keys or just for the calls on the same key?
Somewhere in between; see above. But if you follow this advice in the javadocs, it should not matter.
" Some attempted update operations on this map by other threads may be blocked while computation is in progress, so the computation should be short and simple ..."