refactor: remove no needed refresh of immutable metadata during index metadata load
@@ -483,14 +483,20 @@ public class OIndexManagerShared implements OIndexManagerAbstract {
void addIndexInternal(final OIndex index) {
acquireExclusiveLock();
try {
+ addIndexInternalNoLock(index);
+ } finally {
+ releaseExclusiveLock();
+ }
+ }
+
+ private void addIndexInternalNoLock(final OIndex index) {
final Locale locale = getServerLocale();
indexes.put(index.getName(), index);
final OIndexDefinition indexDefinition = index.getDefinition();
if (indexDefinition == null || indexDefinition.getClassName() == null) return;
- Map<OMultiKey, Set<OIndex>> propertyIndex =
- getIndexOnProperty(indexDefinition.getClassName());
+ Map<OMultiKey, Set<OIndex>> propertyIndex = getIndexOnProperty(indexDefinition.getClassName());
if (propertyIndex == null) {
propertyIndex = new HashMap<>();
@@ -514,9 +520,6 @@ public class OIndexManagerShared implements OIndexManagerAbstract {
classPropertyIndex.put(
indexDefinition.getClassName().toLowerCase(locale), copyPropertyMap(propertyIndex));
- } finally {
- releaseExclusiveLock();
- }
}
static Map<OMultiKey, Set<OIndex>> copyPropertyMap(Map<OMultiKey, Set<OIndex>> original) {
@@ -968,14 +971,14 @@ public class OIndexManagerShared implements OIndexManagerAbstract {
}
if (index.loadFromConfiguration(d)) {
- addIndexInternal(index);
+ addIndexInternalNoLock(index);
} else {
indexConfigurationIterator.remove();
configUpdated = true;
}
} else {
if (index.loadFromConfiguration(d)) {
- addIndexInternal(index);
+ addIndexInternalNoLock(index);
} else {
indexConfigurationIterator.remove();
configUpdated = true;
