tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rémy Maucherat <r...@apache.org>
Subject Re: Does Tomcat8 NIO2 connector support Apache CometEvent?
Date Wed, 02 Nov 2016 09:28:10 GMT
2016-11-02 5:19 GMT+01:00 Bruce Huang <mailbruced@gmail.com>:

> Thanks for your suggestion.
>
> I have tested on 8.0.38 release, but it even can't close the comet
> properly. On 8.0.23, after OutputStream.close(), I have to do event.close()
> to make the END event to be fired correctly.
>
> ServletOutputStream servletOutputStream =
> event.getHttpServletResponse().getOutputStream();
>
> servletOutputStream.write(triggerMessage);
> servletOutputStream.flush();
> servletOutputStream.close();
>
> event.close(); // add for NIO2
>

Why is it "add for NIO2" ? When closing comet, you should use event.close()
(why do you think this API exists ?) *and* flushing+closing the streams is
often a problem. Although I understand the systematic stream close (and
flush, sometimes) comes from java.io, it is useless in Servlets and
sometimes harmful.

>
> I found that the event.close() won't work from v8.0.27~8.0.38 and I could
> make the comet to be connected start from v8.0.9 to v8.0.38, but
> event.setTimeout() are not working on both of them.
>
> Since our server is running on Windows platform, we have to switch to NIO2
> for this issue
> http://tomcat.10.x6.nabble.com/Tomcat-8-uses-high-CPU-td5049333.html
>
> What is the error(s) you get with the latest 8.0 build ?

Since Comet is removed in 8.5 (deprecated in 8.0) and NIO2 was new in 8.0,
it's not a very good combo for support of the feature, but we can give it a
shot.

Rémy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message