[jboss-user] [JBoss Microcontainer] - Re: How to re-compile a class loader

lavot do-not-reply at jboss.com
Thu Jul 5 01:53:30 EDT 2012


lavot [https://community.jboss.org/people/lavot] created the discussion

"Re: How to re-compile a class loader"

To view the discussion, visit: https://community.jboss.org/message/746219#746219

--------------------------------------------------------------
Hi Ales,

Thanks for getting involved in my problem.

I want to change the code to introduce new traces as I want to understand how things work.

Once the traffic is established which means that all the code has been executed once so all the classes are supposed to be loaded there are still some threads that go to block on the synchronize in doLoad(). I would have expected that they exit from loadClass() after the isLoaded() check.

So I want to introduce some little changes in doLoad() to trace which class is preparing to load (at the beginning of doLoad()) and which one actually loaded (at the end). Something like that:
   protected Class<?> doLoadClass(String name, boolean resolve, boolean trace) throws ClassNotFoundException
   {
      Class<?> result;

      // LIONEL
      if (trace)
        log.trace(this + " doLoadClass prepared for " + name );

      synchronized (this)
      {
         // JBCL-114: did we lose the race to the synchronized?
         result = isLoadedClass(name, trace);

         // Not already loaded use the domain
         if (result == null)
            result = loadClassFromDomain(name, trace);

         // Still not found
         if (result == null)
            return null;

        // LIONEL
        if (trace)
            log.trace(this + " doLoadClass actually loaded " + name );

         // Link the class if requested
         if (resolve)
         {
            if (trace)
               log.trace(this + " resolveClass " + ClassLoaderUtils.classToString(result));
            resolveClass(result);
         }

         return result;
      }
   }

>From my traces, all the classes seem to be already loaded but why isn't this determined at the first isLoaded() check in loadClass() (which is not synchronized).

So thanks to help to recompile it.
Lionel
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/746219#746219]

Start a new discussion in JBoss Microcontainer at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2114]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120705/8349d3d9/attachment-0001.html 


More information about the jboss-user mailing list