Hi,

> Where does the "loadClassInternal()" intervene?

It is called by the JVM when it has to resolve class dependencies.

Say you have class A that has a data member of class B.
When a CL is asked to load A, it inspects the class and see that it needs to load also 
B. This is done at native level, and while a classloader is loading class A, the JVM 
calls loadClassInternal() on the *same* thread and on the *same* classloader to load 
class B; this may trigger another call and so on recursively. If the classloader 
delegates to some other classloader you can have deadlock.
There is a call for loadClass, some more call on java code, then a call to native 
method, and if the native method decides it has no sufficient information it calls 
back java code, it's java -> native -> java.

loadClass()
  ...
    defineClass() [is this the native one ?]
      loadClassInternal() 
        loadClass()

I experienced the deadlock problem in another project at work, and it happened to me 
at startup (when not all classes are already loaded and thus loadClassInternal() is 
called frequently). 

A typical scenario for me was this one: jar1 with a set of related classes, and jar2 
with another set, but the 2 jars interacts and are loaded by different classloaders. 
When something is "started" in jar1, not all classes in the jar are loaded; the 
"start" triggers loading from jar2 that happens to load some class from jar1 that was 
not already loaded.

I solved this problem in my project using reflection in the small part that had this 
problem (no data member directly referencing the class). I don't know if this is 
doable also in JBoss (waaay larger than my project :)

Hope helped

Simon

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to