I have a servlet which opens server sockets (not HTTP). When the WAR containing 
the servlet is closed and re-opened the replacement servlet finds that the 
sockets are already open and crashes.

I need some means, inside the servlet, of detecting that the WAR is about to be 
shut down, so that I can close the sockets.  I can see all sorts of useful and 
apparently-relevant lifecycle artifacts inside Jetty. but the Jetty sandboxing 
of the servlet seems complete; I can find no way to link in to these classes.

I've also been trying the PreDestroy approach suggested in 
http://wiki.eclipse.org/Jetty/Feature/Annotations
which looks as if it ought to work but the method tagged with the @PreDestroy 
attribute is never invoked.  I've noted that this is described in Java 8 
documentation and I'm attempting Jetty 9 - is that significant?

I'm running out of ideas now. I have thought of designing a custom 
WebApplicationHandler, which presumably can participate in the lifecycle system 
and could than 'poke' my servlet through a custom Interface, but this is not 
very elegant.

Any other ideas?

Regards,

Chris Haynes

_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to