[concurrency-interest] Another CompletableFuture Question

√iktor Ҡlang viktor.klang at gmail.com
Wed Apr 30 08:55:12 EDT 2014


Hi Haim,


Your (only) options are:

a) blocking (you already provided that solution)
b) polling (have some thread have a set of Futures that it intermittently
checks for isDone and then gets the value out)

CompletableFuture > Future


On Tue, Apr 29, 2014 at 10:02 PM, Haim Yadid <haim at performize-it.com> wrote:

>
> Hi,
> Is the a good way to convert a future to a CompletableFuture ?
> The only way I have found is to wrap the Future which causes an overhead
> of another busy thread.
>
>     public static <V> CompletableFuture<V> convertFuture(Future<V> future)
> {
>         CompletableFuture<V> brighterFuture = supplyAsync(() -> {
>             try {
>                 return future.get();
>             } catch (Exception e1) {
>                 throw new RuntimeException(e1);
>             }
>         });
>         return brighterFuture;
>     }
>
>>
>>
>>
>
> --
> Haim Yadid | Performization Expert
> Performize-IT | t +972-54-7777132
> www.performize-it.com
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
>


-- 
Cheers,
√
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140430/06a9b154/attachment-0001.html>


More information about the Concurrency-interest mailing list