SUGGESTED FIX
The fix of issue 5102804 uses BEANINFO_CACHE lock to synchronize
beanInfoCache collection. You can either make this collection
synchronized using Collections.synchronizedMap (and strip
the synchronization in getBeanInfo(Class)) or leave the collection
as it is and (at least) move invocation of
(new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
outside BEANINFO_CACHE lock, i.e., replace
synchronized (BEANINFO_CACHE) {
...
BeanInfo beanInfo = beanInfoCache.get(beanClass);
if (beanInfo == null) {
beanInfo = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
beanInfoCache.put(beanClass, beanInfo);
}
}
by
synchronized (BEANINFO_CACHE) {
...
BeanInfo beanInfo = beanInfoCache.get(beanClass);
}
if (beanInfo == null) {
beanInfo = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
synchronized (BEANINFO_CACHE) {
beanInfoCache.put(beanClass, beanInfo);
}
}
|