You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Matthew Westwood-Hill <ma...@nuix.com> on 2013/12/09 06:52:31 UTC
Setting unloadDelay within embedded Tomcat
I am running Tomcat embedded via something like the following code:
tomcat = new Tomcat();
tomcat.setBaseDir(DEFAULT_BASE_DIR);
tomcat.getService().addConnector(defaultConnector);
tomcat.setConnector(defaultConnector);
tomcat.init();
tomcat.start();
How do I go about setting the *unloadDelay* property programmatically in
the above example?
Cheers,
Matthew
Re: Setting unloadDelay within embedded Tomcat
Posted by java developer <re...@gmail.com>.
"unloadDelay" property is specific to a web application deployed on the the
tomcat. A web application is represented by Context type.
What you can do is get a reference to the concerned webapp deployed on
tomcat and then set the property. You can do something like below
Container ctx = tomcat.getHost().findChild(contextPath); //tomcat is
variable from your code and contextPath is of your webapp
Context context = (Context)ctx;
context.setUnloadDelay(yourValue);
On Mon, Dec 9, 2013 at 11:22 AM, Matthew Westwood-Hill <
matthew.westwood-hill@nuix.com> wrote:
> I am running Tomcat embedded via something like the following code:
>
>
>
> tomcat = new Tomcat();
>
> tomcat.setBaseDir(DEFAULT_BASE_DIR);
>
> tomcat.getService().addConnector(defaultConnector);
>
> tomcat.setConnector(defaultConnector);
>
> tomcat.init();
>
> tomcat.start();
>
>
>
> How do I go about setting the *unloadDelay* property programmatically in
> the above example?
>
>
>
> Cheers,
>
> Matthew
>