catalog: Add synchronization to fix exception during concurrent catalog initialization. See
@@ -109,20 +109,24 @@ public class CatalogSafetyInitializer {
}
private static void initializeFieldWithValue(final Object obj, final Field f, final Object value) throws IllegalAccessException, ClassNotFoundException {
+ synchronized (perCatalogClassNonRequiredFields) {
f.setAccessible(true);
if (f.get(obj) == null) {
f.set(obj, value);
}
f.setAccessible(false);
}
+ }
private static void initializeArrayIfNull(final Object obj, final Field f) throws IllegalAccessException, ClassNotFoundException {
+ synchronized (perCatalogClassNonRequiredFields) {
f.setAccessible(true);
if (f.get(obj) == null) {
f.set(obj, getZeroLengthArrayInitializer(f));
}
f.setAccessible(false);
}
+ }
private static Object[] getZeroLengthArrayInitializer(final Field f) throws ClassNotFoundException {
