Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] asynchronous flush?

I can't find one.   Our own EventSourceServlet really should do, but currently it is still implemented using blocking IO.

treat it exactly like an async write

cheers


On 29 July 2016 at 18:26, Viktor Szathmáry <phraktle@xxxxxxxxx> wrote:
Hi Greg,

Thanks, that sounds like what I was looking for, will give it a try!

By any chance, is there an example servlet somewhere that does an async flush?

Thanks,
  Viktor



Sent from my iPhone

On Jul 29, 2016, at 04:53, Greg Wilkins <gregw@xxxxxxxxxxx> wrote:


I think Simone is not correct that there is not async flush.
Once you go into Async write mode, then the existing flush API becomes an async flush.

You have to treat it exactly as a write, by calling isReady() before calling flush().   I think close() is treated the same way.

cheers



On 28 July 2016 at 23:36, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
Hi,

On Thu, Jul 28, 2016 at 3:19 PM, Viktor Szathmáry <phraktle@xxxxxxxxx> wrote:
> Hi Simone,
>
> Thanks for the response! CometD sounds like an overkill for this particular
> use case (we’re talking about a  servlet with 200 lines of code :)

Perhaps.

> Asynchronous writes would work, but the part I’m missing is how can one
> force a flush to the client before filling up the buffer.

Ah, you can't with the Servlet APIs, there is no asynchronous flush primitive.
Note that the container can buffer the writes, so just the fact that
you wrote does not mean it went over the network.

That's another reason Server-Sent Events is not such a great solution.
For HelloWorlds kinda works, for all the rest it's very likely that it
will fall short.

--
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--

Back to the top