From 715c889381c4d7183aadadffce8d4c2a62ee0183 Mon Sep 17 00:00:00 2001
From: Alok Joshi <AJoshi19@slb.com>
Date: Fri, 6 Nov 2020 11:33:24 -0600
Subject: [PATCH] remove mutex lock

---
 .../tags/dataaccess/LegalTagRepositoryImpl.java  | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagRepositoryImpl.java b/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagRepositoryImpl.java
index 36d6c68b6..bc88dc043 100644
--- a/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagRepositoryImpl.java
+++ b/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/tags/dataaccess/LegalTagRepositoryImpl.java
@@ -32,14 +32,11 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
-import java.util.concurrent.locks.ReentrantLock;
 import java.util.stream.Collectors;
 
 @Repository
 public class LegalTagRepositoryImpl implements ILegalTagRepository {
 
-    private ReentrantLock mutex = new ReentrantLock();
-
     @Autowired
     private CosmosStore cosmosStore;
 
@@ -59,16 +56,11 @@ public class LegalTagRepositoryImpl implements ILegalTagRepository {
         String strId = String.valueOf(id);
 
         LegalTagDoc legalTagDoc = new LegalTagDoc(strId, legalTag);
-        try {
-            mutex.lock();
-            Optional<LegalTagDoc> existingDoc = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, legalTagsContainer, strId, strId, LegalTagDoc.class);
-            if (existingDoc.isPresent()) {
-                throw AppException.legalTagAlreadyExistsError(legalTag.getName());
-            }
-            cosmosStore.createItem(headers.getPartitionId(), cosmosDBName, legalTagsContainer, legalTagDoc);
-        } finally {
-            mutex.unlock();
+        Optional<LegalTagDoc> existingDoc = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, legalTagsContainer, strId, strId, LegalTagDoc.class);
+        if (existingDoc.isPresent()) {
+            throw AppException.legalTagAlreadyExistsError(legalTag.getName());
         }
+        cosmosStore.createItem(headers.getPartitionId(), cosmosDBName, legalTagsContainer, legalTagDoc);
         return id;
     }
 
-- 
GitLab