i would like to load a singleton type resource WHEN TOMCAT STARTS.
currently, the way i do it, the resource is initialized when it is first
looked up from the context by a client. i understand that i can make a
bastardized servlet, which does nothing related to http and is in web.xml
and it loads that resource but that does not seem like an elegant solution.
the reason i wanna do this is because this init process can take some time
and i don't want the 1st unlucky user whose thread requests it to wait.
so, what i have in context.xml is:
<Resource name="rsrc-generic" auth="Container"
type="com.selma.resource.Generic"
factory="org.apache.naming.factory.BeanFactory"
someVal="x"/>
in web.xml:
<resource-env-ref>
<description>
Object factory for MyBean instances.
</description>
<resource-env-ref-name>
rsrc-generic
</resource-env-ref-name>
<resource-env-ref-type>
com.selma.resource.Generic
</resource-env-ref-type>
</resource-env-ref>
com.selma.resource.Generic is constructed only when first looked up from the
context. i want it done when the server starts. can it be done ?
thanks
--
View this message in context:
http://old.nabble.com/resource-init-upon-TC-start%2C-not-when-context-lookup-tp26328510p26328510.html
Sent from the Tomcat - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]