I'm currently using the following architecture to initialize
application-wide resource (such as database connection pools):

Define a servlet that in:

  init() - creates resources, and stores them as attributes on the servlet
context

  destroy() - removes these attributes from the servlet context. As this is
the only reference to
    them, they are then unavailable, and will eventually be garbage collected.

Different JSP pages can then grab these resources as application-scope beans.

Reading the Servlet specification, it says the Servlet container can unload
a servlet at any time - this means that my global resources will suddenly
become unavailable! Is this correct?

How are other people dealing with the problems of
initialization/destruction of application-scope resources?

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to