"Jung , Dr. Christoph" wrote:
> 
> I must correct myself! We have a principle problem, unfortunately, for which
> I do not
> have an immediate answer right now:
> 
> Actually, instead of synchronized(classLoaders) in ServiceLibraries, there
> would be the need
> to *atomically* synchronize on all instances of the set in order  not to
> interfere with the ClassLoader.loadClassInternally() calls.
> 
> But this is not possible with the Java synchronization mechanism, AFAIK.

Please forgive me if I am wrong - I'm not very familiar
with this code.

But isn't the only reason for synchronizing on classLoaders
that there would be problems if another thread tries to
add or remove classloaders while the Set is traversed?

If this is the case, couldn't we avoid synchronizing on it
by making ServiceLibraries.addClassLoader() and
removeClassloader() create an entire new Set?

Of course, then these methods would have to be synchronized,
and we would probably also have to synchronize on the
instance variables classes, resources, clToClassSetMap and
clToResourceSetMap, but these locks would not be held
while ClassLoader.loadClassInternally() is called.


Best Regards,

Ole Husgaard.

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

Reply via email to