I created sample projects to understand how to use tomcat embedded:
tomcat embedded 9 with javax
tomcat embedded 10 with jakarta
On ServletDestroy, in below order:
- I destroyed connectors.
- I wait 5 seconds.
- I destroyed context.
- I wait 5 seconds.
- I stopped tomcat.
- I wait 5 seconds.
- I destroyed tomcat.
But it does not shutdown gracefully; function TS_TomcatListener.contextDestroyed never called.
What is the right way to do it?
CodePudding user response:
For some reason Servlet classes attached to context by annotation cannot read static objects.
I fixed this issue, by sending tomcat object while constructing the ServletDestroy class and mapped it to contexed manually.