You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Romain Manni-Bucau <rm...@gmail.com> on 2016/09/29 12:12:14 UTC

classResources.start() can be duplicated

Hi guys,

StandardRoot does that at the moment (taken the 8.5.5 as a reference for
this mail):

for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
        webResourceSet.start();
    }
}

// This has to be called after the other resources have been started
// else it won't find all the matching resources
processWebInfLib();
// Need to start the newly found resources
for (WebResourceSet classResource : classResources) {
    classResource.start();
}



This works well in a plain Tomcat but suppose you configure class resources
before that method (statically or programmatically through a listener) then
the iteration over allResources iterates over classesResources and then it
is done again. Doesn't hurt much excepted this log:

14:09:57.362 [main] INFO  org.apache.catalina.util.LifecycleBase - The
start() method was called on component
[org.apache.catalina.webresources.JarResourceSet@2ee5c08d] after start()
had already been called. The second call will be ignored.

Would it be possible to modify it to be:

for (List<WebResourceSet> list : allResources) {
    for (WebResourceSet webResourceSet : list) {
        if (webResourceSet != classResources) webResourceSet.start();

    }
}

// This has to be called after the other resources have been started
// else it won't find all the matching resources
processWebInfLib();
// Need to start the newly found resources
for (WebResourceSet classResource : classResources) {
    classResource.start();
}


?

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

Re: classResources.start() can be duplicated

Posted by Romain Manni-Bucau <rm...@gmail.com>.
2016-09-29 15:14 GMT+02:00 Mark Thomas <ma...@apache.org>:

> On 29/09/2016 13:12, Romain Manni-Bucau wrote:
> > Hi guys,
> >
> > StandardRoot does that at the moment (taken the 8.5.5 as a reference for
> > this mail):
> >
> > for (List<WebResourceSet> list : allResources) {
> >     for (WebResourceSet webResourceSet : list) {
> >         webResourceSet.start();
> >     }
> > }
> >
> > // This has to be called after the other resources have been started
> > // else it won't find all the matching resources
> > processWebInfLib();
> > // Need to start the newly found resources
> > for (WebResourceSet classResource : classResources) {
> >     classResource.start();
> > }
> >
> >
> >
> > This works well in a plain Tomcat but suppose you configure class
> resources
> > before that method (statically or programmatically through a listener)
> then
> > the iteration over allResources iterates over classesResources and then
> it
> > is done again. Doesn't hurt much excepted this log:
> >
> > 14:09:57.362 [main] INFO  org.apache.catalina.util.LifecycleBase - The
> > start() method was called on component
> > [org.apache.catalina.webresources.JarResourceSet@2ee5c08d] after start()
> > had already been called. The second call will be ignored.
> >
> > Would it be possible to modify it to be:
>
> Happy to fix it, but the change below isn't right. It should be:
> list != classResources
>
> I'll fix this in the next couple of minutes.
>
>
+1! Thanks a lot


> Mark
>
>
> >
> > for (List<WebResourceSet> list : allResources) {
> >     for (WebResourceSet webResourceSet : list) {
> >         if (webResourceSet != classResources) webResourceSet.start();
> >
> >     }
> > }
> >
> > // This has to be called after the other resources have been started
> > // else it won't find all the matching resources
> > processWebInfLib();
> > // Need to start the newly found resources
> > for (WebResourceSet classResource : classResources) {
> >     classResource.start();
> > }
> >
> >
> > ?
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> > <http://rmannibucau.wordpress.com> | Github <https://github.com/
> rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com> | JavaEE Factory
> > <https://javaeefactory-rmannibucau.rhcloud.com>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Re: classResources.start() can be duplicated

Posted by Mark Thomas <ma...@apache.org>.
On 29/09/2016 13:12, Romain Manni-Bucau wrote:
> Hi guys,
> 
> StandardRoot does that at the moment (taken the 8.5.5 as a reference for
> this mail):
> 
> for (List<WebResourceSet> list : allResources) {
>     for (WebResourceSet webResourceSet : list) {
>         webResourceSet.start();
>     }
> }
> 
> // This has to be called after the other resources have been started
> // else it won't find all the matching resources
> processWebInfLib();
> // Need to start the newly found resources
> for (WebResourceSet classResource : classResources) {
>     classResource.start();
> }
> 
> 
> 
> This works well in a plain Tomcat but suppose you configure class resources
> before that method (statically or programmatically through a listener) then
> the iteration over allResources iterates over classesResources and then it
> is done again. Doesn't hurt much excepted this log:
> 
> 14:09:57.362 [main] INFO  org.apache.catalina.util.LifecycleBase - The
> start() method was called on component
> [org.apache.catalina.webresources.JarResourceSet@2ee5c08d] after start()
> had already been called. The second call will be ignored.
> 
> Would it be possible to modify it to be:

Happy to fix it, but the change below isn't right. It should be:
list != classResources

I'll fix this in the next couple of minutes.

Mark


> 
> for (List<WebResourceSet> list : allResources) {
>     for (WebResourceSet webResourceSet : list) {
>         if (webResourceSet != classResources) webResourceSet.start();
> 
>     }
> }
> 
> // This has to be called after the other resources have been started
> // else it won't find all the matching resources
> processWebInfLib();
> // Need to start the newly found resources
> for (WebResourceSet classResource : classResources) {
>     classResource.start();
> }
> 
> 
> ?
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
> <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com> | JavaEE Factory
> <https://javaeefactory-rmannibucau.rhcloud.com>
> 


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