Try asking this on the Tomcat Users List.

p


On 12/11/2009 23:40, foampile wrote:

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to