[concurrency-interest] conditional put

Dhanji R. Prasanna dhanji at gmail.com
Mon Nov 5 21:28:00 EST 2007


Hi,

CHM is a wonderful abstraction for atomic conditional puts
(putIfAbsent). However, it does not work well in a lambda-like use
case (i.e. evaluate if absent).

Is there some way for me to achieve the following:

chm.putIfAbsent(key, new Callable<Value> {
    //expression that is only evaluated if key is absent
});

And that this callable is evaluated atomically.
Thank you,

Dhanji.


More information about the Concurrency-interest mailing list