From e3572da149ae4740097756587b4b037fe52b0a56 Mon Sep 17 00:00:00 2001 From: Pavol Mederly Date: Wed, 28 Aug 2019 12:22:51 +0200 Subject: [PATCH] Re-enable synchronization on ExtItemDictionary This is a safety measure, treating potential concurrency issues - but only if they occur on the same node. See MID-4799, MID-4710. --- .../data/common/dictionary/ExtItemDictionary.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/dictionary/ExtItemDictionary.java b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/dictionary/ExtItemDictionary.java index 7f8669cdd74..21039114d6b 100644 --- a/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/dictionary/ExtItemDictionary.java +++ b/repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/data/common/dictionary/ExtItemDictionary.java @@ -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); } @@ -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) {