[concurrency-interest] Another CompletableFuture Question

Haim Yadid haim at performize-it.com
Wed Apr 30 09:00:34 EDT 2014


Thanks Viktor
Do you ( or anyone else ) know why

   - AsynchronousFileChannel
   - AsynchronousServerSocketChannel
   - AsynchronousSocketChannel

where not converted to support CompletableFutures as well?


On Wed, Apr 30, 2014 at 3:55 PM, √iktor Ҡlang <viktor.klang at gmail.com>wrote:

> 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,
>>



-- 
Haim Yadid | Performization Expert
Performize-IT | t +972-54-7777132
www.performize-it.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140430/93a61258/attachment.html>


More information about the Concurrency-interest mailing list