Skip to content

Commit

Permalink
Remove Java synchronization from ExtItemDictionary
Browse files Browse the repository at this point in the history
This is to allow race conditions to manifest themselves during
4.0 development. (Java synchronization masks them.) To be re-added
before release, see MID-4799.
  • Loading branch information
mederly committed Nov 14, 2018
1 parent 3a9cf9d commit b064664
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -91,18 +91,21 @@ private void fetchItemsAttempt() {
}
}

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

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

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

Expand Down Expand Up @@ -173,7 +176,8 @@ private void executeAttempts(String operationName, String operationVerb, Runnabl
}
}

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

0 comments on commit b064664

Please sign in to comment.