Merge "Issue #1744 fix deadlock" into omaha_13.3.1
Former-commit-id:79c70dacbd
[formerly79c70dacbd
[formerly 6fbc789e08a5e6baf7ae6ff1348e1e2c5709c422]] Former-commit-id:7dcc007bee
Former-commit-id:3a8a2f5815
This commit is contained in:
commit
5a05a66757
1 changed files with 9 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue