users@jersey.java.net

[Jersey] Proper shutdown / destroy when using com.sun.jersey.spi.container.servlet.ServletContainer

From: Matthew Hall <mhall_at_mhcomputing.net>
Date: Thu, 11 Apr 2013 14:01:22 -0700

Hello,

I am using com.sun.jersey.spi.container.servlet.ServletContainer to start my
application.

The application creates some resources which can leak inside of Tomcat
(ThreadLocals, etc.), and produce leak warnings from Tomcat.

If I were making a normal Servlet I could code up a destroy() method. But I'm
not sure how to do it in Jersey since I'm not a subclass of Jersey's
ServletContainer and it's going to load my resources with reflection.

What's the right way to handle this?

Thanks,
Matthew.