Merge "Issue #1744 fix deadlock" into omaha_13.3.1

Former-commit-id: 79c70dacbd [formerly 79c70dacbd [formerly 6fbc789e08a5e6baf7ae6ff1348e1e2c5709c422]]
Former-commit-id: 7dcc007bee
Former-commit-id: 3a8a2f5815
This commit is contained in:
Richard Peter 2013-03-01 10:27:36 -06:00 committed by Gerrit Code Review
commit 5a05a66757

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) {