jchen21 commented on a change in pull request #5014:
URL: https://github.com/apache/geode/pull/5014#discussion_r419022085



##########
File path: 
geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
##########
@@ -1086,6 +1088,32 @@ public static GemFireCacheImpl getForPdx(String reason) {
     clientMetadataService = clientMetadataServiceFactory.apply(this);
   }
 
+  public void lockDiskStore(String diskStoreName) {
+    CountDownLatch countDownLatch = diskStoreLatches.get(diskStoreName);
+    if (countDownLatch == null) {
+      countDownLatch = diskStoreLatches.putIfAbsent(diskStoreName, new 
CountDownLatch(1));
+      if (countDownLatch != null) {
+        try {
+          countDownLatch.await();
+        } catch (InterruptedException e) {
+          throw new InternalGemFireError(e);
+        }
+      }
+    } else {
+      try {
+        countDownLatch.await();
+      } catch (InterruptedException e) {
+        throw new InternalGemFireError(e);
+      }
+    }
+  }
+
+  public void unlockDiskStore(String diskStoreName) {
+    if (diskStoreLatches.get(diskStoreName) != null) {
+      diskStoreLatches.get(diskStoreName).countDown();
+    }

Review comment:
       @jujoramos if the entry is `null`, we can't tell whether it is because 
the disk store is removed, or somebody invokes `unlockDiskStore` before 
`lockDiskStore`. We don't want to throw an exception, when the entry is `null` 
because the disk store is removed. I would  prefer not throwing an exception 
when the entry is `null`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to