Issue #1744 fix deadlock

Change-Id: I2cff166dcdb217e0c7665deece302e5c9ac92c8f

Former-commit-id: 394a96db44 [formerly e2f12d16b7] [formerly 2a575a24e7] [formerly f4cccabc07 [formerly 2a575a24e7 [formerly 48ef00523488cdf4f65b86c5b74331f908192191]]]
Former-commit-id: f4cccabc07
Former-commit-id: cea33e5e9d7f091f9ec47d746199097bf2783899 [formerly f7ffa22c7c]
Former-commit-id: c5600acf79
This commit is contained in:
Nate Jensen 2013-03-01 10:11:31 -06:00
parent a8f39fdca4
commit 91d577f4db

View file

@ -34,6 +34,7 @@ import net.sf.cglib.reflect.FastClass;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 3, 2008 #1448 chammack Initial creation
* Mar 1, 2013 #1744 njensen Fix deadlock
* </pre>
*
* @author chammack
@ -100,7 +101,14 @@ public class SerializationCache {
generator.setClassLoader(SerializationCache.class.getClassLoader());
generator.setBean(obj);
bm = generator.create();
// must synchronize create() call to safely avoid deadlock between
// cglib and eclipse classloader. cglib synchronizes inside create()
// and will block other threads, meanwhile deeper inside create()
// it needs to obtain a lock on the classloader which another thread
// might already have
synchronized (SerializationCache.class) {
bm = generator.create();
}
generator.setBean(null);
synchronized (generators) {