Hi, Why go through all this? The point of the JNDI Resources part of the Servlet Specification is to allow portable interaction with external resources. Your approach loses all the portability (it's Tomcat-specific) without gaining much of anything. You could do the same stuff in your webapp, instead relying on a portable notification of app shutdown (ServletCotnextListener) and managing your own object creation/destruction.
Yoav Shapira http://www.yoavshapira.com >-----Original Message----- >From: Seth Ladd [mailto:[EMAIL PROTECTED] >Sent: Monday, December 13, 2004 1:10 PM >To: [EMAIL PROTECTED] >Subject: A Resource ObjectFactory as LifecycleListener ? > >Hello, > >I've setup a ObjectFactory for Tomcat's JNDI and Resource system. I'd >like that that ObjectFactory to respond to the Tomcat Server shutting >down. It appears that a new ObjectFactory is created for every request >for the Object, so ObjectFactory itself is not a singleton. That's OK >for now. > >The Object that is returned by the ObjectFactory is a singleton (in a >sense) and I'd like that Object to shutdown cleanly when the Server >shuts down. > >One idea I had was to create a <Listener> that would shut down the >singleton. The ObjectFactory would continue to serve the singleton via >JNDI. The problem there is I might have to duplicate some class files >because the <Listener> will load its classes from server/lib, while the >ObjectFactory will load its classes from common/lib. > >If I could have the <Resource> or the ObjectFactory participate as a >LifecycleListener, I think it would work very smoothly. I looked >through the code, and it doesn't appear possible. > >Thanks, >Seth > >-- ><a href="http://www.picklematrix.net/foaf.rdf">Seth Ladd's FOAF</a> ><a href="http://www.foaf-project.org/">What is FOAF?</a> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
