"Jung , Dr. Christoph" wrote:
> 
> >If the deadlock between these two classes can occur, CL1
> >must use CL2 to load C2, and CL2 must use CL1 to load C1.
> >But that would mean that CL2 is a parent of CL1, and CL1
> >is a parent of CL2. I believe that circular class loader
> >parentage is impossible in Java.
> 
> But that is exactly the central design of the RH-ServiceLibraries!
> 
> In order to make hot-deploy of server parts possible, the code that would
> normally be deployed into a single classloader, is now dsitributed into a
> set of *mutually dependent* classloaders.
> 
> This is reached by delegating the URLClassLoader.loadClass(String, boolean)
> to
> ServiceLibraries.loadClass(String,boolean) which then dispatches again to
> the
> individual ClassLoader.loadClass(String, boolean).
> 
> Since ClassLoader.loadClassInternal(String) and
> ClassLoader.loadClass(String,boolean)
> are both synchronized on the instances, we could run into the problem, no
> matter whether
> ServiceLibraries does or does not lock anything, right?

Sorry, I still do not see how this is possible.

- org.jboss.system.ServiceLibraries can only contain classloaders
  of class org.jboss.system.URLClassLoader.
- All instances of org.jboss.system.URLClassLoader are created
  with the system class loader as parent, as it has no constructor
  to explicitly set another parent.
- org.jboss.system.URLClassLoader.loadClass(String, boolean)
  delegates directly to the ServiceLibraries _without_ obtaining
  an instance lock.

I have this strange feeling that I am overlooking something,
as I dont see the circularity.

Can the system class loader somehow end up calling the
ServiceLibraries?


Best Regards,

Ole Husgaard.

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

Reply via email to