users@jersey.java.net

[Jersey] Async Client

From: Robert DiFalco <robert.difalco_at_gmail.com>
Date: Wed, 31 Dec 2014 12:05:06 -0800

I think I'm missing something about the design with the AsyncInvoker.

It appears I can do a post with an InvocationCallback. That part is very
cool. What seems crazy is that it returns a future and the future has
nothing to do with the #complete method of the Callback.

Wouldn't you normally expect the Callback#complete (or failure) to return
something and then have that be what #get in the returned future return?

Not only is nothing like that support but if you return a Future<Response>
and your Callback#complete does a response.readEntity() and then you do a
response.readEntity from your future.get() then you can have a RACE
condition. So even if you have both call #bufferEntity, you can end up with
a malformed entity stream.

Am I missing something or was this just a missed design flaw?