Hi Bjorn,

I'm looking into the issue(I had been longing to contribute to community
and I see some opportunity to start doing so here. Hope my effort will be
welcomed!:) )


I'm looking at the code base in trunk. Here is the method where
localhost-startstop thread is busy:


   protected void processAnnotationsFile(File file, WebXml fragment, //line
1963
            boolean handlesTypesOnly) {

        if (file.isDirectory()) {
            // Returns null if directory is not readable
            String[] dirs = file.list();//line 1968
            if (dirs != null) {
                for (String dir : dirs) {
                    processAnnotationsFile(    //line 1971
                            new File(file,dir), fragment, handlesTypesOnly);
                }
            }
        } else if (file.canRead() && file.getName().endsWith(".class")) {
            try (FileInputStream fis = new FileInputStream(file)) {
                processAnnotationsStream(fis, fragment, handlesTypesOnly);
            } catch (IOException e) {
                log.error(sm.getString("contextConfig.inputStreamFile",
                        file.getAbsolutePath()),e);
            } catch (ClassFormatException e) {
                log.error(sm.getString("contextConfig.inputStreamFile",
                        file.getAbsolutePath()),e);
            }
        }
    }

As you can see and as konstantin said, the thread is busy walking over
directories listed in web-fragements. Here it is from where it is being
called:

 protected void processAnnotations(Set<WebXml> fragments,
            boolean handlesTypesOnly) {
        for(WebXml fragment : fragments) {
            // Only need to scan for @HandlesTypes matches if any of the
            // following are true:
            // - it has already been determined only @HandlesTypes is
required
            //   (e.g. main web.xml has metadata-complete="true"
            // - this fragment is for a container JAR (Servlet 3.1 section
8.1)
            // - this fragment has metadata-complete="true"
            boolean htOnly = handlesTypesOnly || !fragment.getWebappJar() ||
                    fragment.isMetadataComplete();

            WebXml annotations = new WebXml();
            // no impact on distributable
            annotations.setDistributable(true);
            URL url = fragment.getURL();
            processAnnotationsUrl(url, annotations, htOnly);// This in turn
calls processAnnotationsFile
            Set<WebXml> set = new HashSet<>();
            set.add(annotations);
            // Merge annotations into fragment - fragment takes priority
            fragment.merge(set);
        }
    }

I'will let you know, as soon as I come to some concrete understanding.
Meanwhile you can take a look at various web-fragments in your
web-application.

Regards,
Ameer Mawia,
New Delhi

On Mon, Nov 10, 2014 at 4:55 AM, Bjørn T Johansen <b...@havleik.no> wrote:

> On Sun, 09 Nov 2014 23:49:54 +0100
> André Warnier <a...@ice-sa.com> wrote:
>
> > Bjørn T Johansen wrote:
> > > On Mon, 10 Nov 2014 00:35:46 +0300
> > > Konstantin Kolinko <knst.koli...@gmail.com> wrote:
> > >
> > >> Rules:
> > >> http://tomcat.apache.org/lists.html#tomcat-users
> > >> -> 6. Do not top-post.
> > >>
> > >>> Ok, did a thread dump that resulted in the following dump..:
> > >>>
> > >>>
> > >>> Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.25-b02 mixed
> mode):
> > >>>
> > >>> "localhost-startStop-1" #15 daemon prio=5 os_prio=0
> tid=0x00007fdc84002000 nid=0x702 runnable [0x00007fdc8ebe7000]
> > >>>    java.lang.Thread.State: RUNNABLE
> > >>>         at java.io.UnixFileSystem.checkAccess(Native Method)
> > >>>         at java.io.File.canRead(File.java:768)
> > >>>         at
> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1975)
> > >>>         at
> org.apache.catalina.startup.ContextConfig.processAnnotationsFile(ContextConfig.java:1971)
> > >>
> > >> As it is visible from the method name, the "start" thread is busy
> > >> scanning classes for annotations.
> > >>
> > >> This behaviour is explained here:
> > >>
> > >>>> https://wiki.apache.org/tomcat/HowTo/FasterStartUp#General
> > >
> > > But it never finishes? And also I do not have this problem when
> stopping and starting the Tomcat server without booting, why is that?
> Shouldn't the
> > > result be the same?
> > >
> >
> > http://en.wikipedia.org/wiki/Entropy_%28computing%29
> > Maybe your problem is there ?
> > (When the system boots, it has little entropy available, and it may
> already be consumed by
> > other processes starting around the same time).
> >
>
> Hmm... Guess I'll havce to check it out... Thx... :)
>
> BTJ
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to