tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: resource init upon TC start, not when context lookup
Date Thu, 12 Nov 2009 23:51:43 GMT
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message