My Setup is Windows10 / eclipse / tomcat8 / jersey. I have a simple backend that handles some ajax long polling from the front-end.

Now, if there is no front-end running, when I want tomcat to stop, I press "stop" in the "servers" panel in eclipse. This works a charm, tomcat is stopped within a second.

However, when I have a front-end which is currently performing a long poll, and I press "stop", it takes in total about 8 seconds, irrespective of the remaining long polling time (I tried 10s and 15s).

I thought, maybe I just need to interrupt the long polling immediately before the shutdown, so I installed a ServletContextListener using @WebListener, and I get the contextDestroyed callback perfectly fine, but only 7 seconds after pressing "stop". This doesn't help the issue..

Currently on jersey 2.41 and servlet-api 3.1.0. The long polling is implemented with @Suspended AsyncResponse.

Is there an alternative callback that comes earlier? Am I missing something? Any help appreciated.

0

There are 0 best solutions below