Thats an interesting question.

Specifically to Tomcat and struts, does the JNDI stuff accomplish this similiarly to how it handles pooled db connections?

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html

So, if you create a new resource in the config does it create that resource at tomcat start-up, on first use or on every use?

New to it all sorry if its a stupid question. I've been seeing a need for this in my apps as well.

John-

On Wed, 04 Feb 2004 11:59:43 -0800
 [EMAIL PROTECTED] wrote:
hi,

I have a question regarding data objects that should be accessible from the entire application and which must be created at container startup time.

I need to either create and load an existing index or load a serialized index if one exists. This can be a time-consuming process, and I would like to do it once when the servlet container starts, then keep the index in memory thereafter and available to the entire web application.

I've seen a few different ways of doing this by searching the archives, but there wasn't a definitive best practice solution that I came across, and the struts API has also changed since many of the suggestions were offered.

At present, I am extending the ActionServlet and taking care of the initialization stuff in the subclass's init(). I place the generated index in the ServletContext. This ensures that the index creation will occur only once, at container startup, and that it will be available to the action classes of that web application, but I'm not sure if this is the best solution. Also, I have just come across plugins for the first time, and it seems that they also provide a way of doing application-specific initialization. Having the index creation code in the ActionServlet, as it is at present, seems messy to me, so perhaps that is not the best place for it.

In short, what is the best method for ensuring that a global index is created exactly once, and at container startup time? At present, I am subclassing ActionServlet, and doing it there, but is the plugin mechanism an alternate (better?) solution? Is the ServletContext the appropriate place for global data?

thanks in advance,

n.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to