Hi, > I think I've found the problems. > > Problem 1 > --------- > A does a normal loadClass() - no lock on UCL > it gets past synchronise into the main routine > B does a loadClassInternal() - locks the UCL > A reaches unsynchronise, aquires the reentrantLock, releases > itself as the currentThread and waits on the UCL > B runs synchronise which tries to aquire the reentrantLock > > Result > A holds the reentrantLock and is waiting for the UCL > B holds the UCL and is waiting for the reentrantLock > > Problem 2 > --------- > A is the current thread in the repository > B does a loadClassInternal() - locks the UCL > C does a loadClass, synchronise, aquires the reentrantLock, > it cannot continue because A is the currentThread, it waits > on the UCL > B runs synchronise which tries to aquire the reentrantLock > > Result > C holds the reentrantLock and is waiting for the UCL > B holds the UCL and is waiting for the reentrantLock > A will hit a problem when it tries to unsynchronise > > Moving the cl.notifyAll() to after the reentrantLock.release() in > unsynchronize() fixes problem 1. > > Moving the reentrantLock.release() before the syncrhonized(cl) > in synchronize() fixes problem 2 > > My testsuite now completes without hanging. :-) > > But.... > // This release() must be inside the synchronization block on the > classloader > // to avoid that a notifyAll() will arrive before the wait() > below, see > unsynchronize()
Uhm, I think this constraint can be removed. Adrian, I am incorporating your suggestions as we speak, and I will also make ULR a single threaded class for every method. Thanks for the great catches. Cheers Simon _______________________________________________________________ Don't miss the 2002 Sprint PCS Application Developer's Conference August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
