How to get back async value for invokeAll

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

How to get back async value for invokeAll

Hi, fairly new to lambdas and stuff like that. So just wondering how would I get back my values from an cache.invokeAll()?

http://pastebin.com/JxRd8G7S

javadevmtl javadevmtl
Reply | Threaded
Open this post in threaded view
|

Re: How to get back async value for invokeAll

This seems to do the trick...

cache.<Map<String,CacheInvokeResult<String>>>future().listen(ia -> {
        ia.get().forEach((k,v)->{
                System.out.println("Result Key: " + k + ", Value: " + v.get());
        });
});
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: How to get back async value for invokeAll

Looks correct in case you really want to do this asynchronously. Otherwise you can simply use the map of results returned from invokeAll() method.

-Val