drapostolos / rdp4j

Remote Directory Poller for Java
MIT License
47 stars 25 forks source link

Suggestion to replace the Future by CompletableFuture #15

Open guilherme-alves-silve opened 8 years ago

guilherme-alves-silve commented 8 years ago

I suggest replacing the Future by CompletableFuture, because the get method of Future blocks the calling thread. The CompletableFuture can easily be composed and using him with asynchronous methods is easier too. References: http://www.nurkiewicz.com/2013/05/java-8-definitive-guide-to.html https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html How to solve the callback hell problem with CompletableFuture: http://qrman.github.io/posts/2015/08/28/callback_hell_completablefuture_ftw/

Keep the good work

drapostolos commented 8 years ago

Thanks, I'll have a look at this :+1:

If you're willing to do a pull request, please do.

However, code is currently java6 compatible. Should we abandon java6/7 support?

guilherme-alves-silve commented 7 years ago

I think that would be a good idea to implement your own CompletableFuture. It's not hard. I can help. I think support for Java 6/7 it's good for old programs.

alexander-poulikakos commented 7 years ago

Please go ahead and provide a PR and I'll have a look at it. thx!