Skip to content

Commit

Permalink
Re-enable synchronization on ExtItemDictionary
Browse files Browse the repository at this point in the history
This is a safety measure, treating potential concurrency issues
- but only if they occur on the same node. See MID-4799, MID-4710.
  • Loading branch information
mederly committed Aug 28, 2019
1 parent 05693d0 commit e3572da
Showing 1 changed file with 4 additions and 8 deletions.
Expand Up @@ -92,21 +92,18 @@ private void fetchItemsAttempt() {
}
}

// TODO add "synchronized" before 4.0 release
@NotNull
public RExtItem createOrFindItemDefinition(@NotNull ItemDefinition<?> definition, boolean throwExceptionAfterCreate) {
public synchronized RExtItem createOrFindItemDefinition(@NotNull ItemDefinition<?> definition, boolean throwExceptionAfterCreate) {
return createOrFindItemByDefinitionInternal(definition, true, throwExceptionAfterCreate);
}

// TODO add "synchronized" before 4.0 release
@NotNull
public RExtItem createOrFindItemDefinition(@NotNull ItemDefinition<?> definition) {
public synchronized RExtItem createOrFindItemDefinition(@NotNull ItemDefinition<?> definition) {
return createOrFindItemByDefinitionInternal(definition, true, true);
}

// TODO add "synchronized" before 4.0 release
@Nullable
public RExtItem findItemByDefinition(@NotNull ItemDefinition<?> definition) {
public synchronized RExtItem findItemByDefinition(@NotNull ItemDefinition<?> definition) {
return createOrFindItemByDefinitionInternal(definition, false, true);
}

Expand Down Expand Up @@ -177,8 +174,7 @@ private void executeAttempts(String operationName, Class<?> type, String operati
}
}

// TODO add "synchronized" before 4.0 release
public RExtItem getItemById(Integer extItemId) {
public synchronized RExtItem getItemById(Integer extItemId) {
boolean fresh = fetchItemsIfNeeded();
RExtItem extItem = itemsById.get(extItemId);
if (extItem != null || fresh) {
Expand Down

0 comments on commit e3572da

Please sign in to comment.