Issue #1744 fix deadlock
Change-Id: I2cff166dcdb217e0c7665deece302e5c9ac92c8f Former-commit-id:394a96db44
[formerlye2f12d16b7
] [formerly2a575a24e7
] [formerlyf4cccabc07
[formerly2a575a24e7
[formerly 48ef00523488cdf4f65b86c5b74331f908192191]]] Former-commit-id:f4cccabc07
Former-commit-id: cea33e5e9d7f091f9ec47d746199097bf2783899 [formerlyf7ffa22c7c
] Former-commit-id:c5600acf79
This commit is contained in:
parent
a8f39fdca4
commit
91d577f4db
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