Skip to content

Rewrite NettyResponseFuture using CompletableFuture #1294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2016

Conversation

stepancheg
Copy link
Contributor

CompletableFuture seems to be as expensive as CountDownLatch, however, when user asks for toCompletableFuture, NettyResponseFuture now returns already allocated CompletableFuture object without Runnable registration in AbstractListenableFuture.

Also, I believe that CompletableFuture is well optimized.

Tests pass, although it is hard to tell if anything is broken, because NettyResponseFuture implementation is hard.

@slandelle slandelle added this to the 2.0.21 milestone Oct 28, 2016
@slandelle
Copy link
Contributor

Looking good! Please let me review carefully later today.

@@ -47,24 +45,18 @@
*
* @param <V> the result type
*/
public final class NettyResponseFuture<V> extends AbstractListenableFuture<V> {
public final class NettyResponseFuture<V> implements ListenableFuture<V> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So AbstractListenableFuture and RunnableExecutorPair can be removed, as they are replaced with CompletableFuture#whenCompleteAsync, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Should I remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, please

@stepancheg
Copy link
Contributor Author

Update PR with removed AbstractListenableFuture and RunnableExecutorPair.

@slandelle slandelle merged commit 7f3370b into AsyncHttpClient:master Oct 29, 2016
@slandelle
Copy link
Contributor

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants