Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty HTTP client async mode

Oops, sorry, forgot about the language. Hope it's ok as it makes no difference 

чт, 28 июля 2016 г., 18:12 Sergey Mashkov <sergey.mashkov@xxxxxxxxxxxxx>:
Hi,

yes, I am sure. See a gist with the test case:

https://gist.github.com/cy6erGn0m/68582925c042436b84bb135a5b9858f0


---------------------------------------------
On Thu, Jul 28, 2016 at 4:06 PM, Sergey Mashkov
<sergey.mashkov@xxxxxxxxxxxxx> wrote:
> Hi everyone
>
> I am experiencing difficulties with async jetty HTTP client api. I have a
> request, I setup async content listener like this
>
> request.onResponseContentAsync { response, buffer, callback ->
> // schedule some async task then call callback.success() on completed
> }
>
> It works but I am receiving next events before the callback get notified so
> I can't stop events.

Are you sure ?
That is exactly the meaning of the callback, to stop delivering events
until succeeded() (or failed()) is called.

> The only solution is to block inside the handler but it
> doesn't look like async at all. Is there way to suspend upcoming events
> until callback.success() called?

If it does not work it's a bug, but we have test cases that cover this.

Can you put up a reproducible test case that shows the issue ?

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.


Back to the top