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



##########
File path: 
geode-core/src/test/java/org/apache/geode/internal/cache/GemFireCacheImplTest.java
##########
@@ -620,6 +625,40 @@ public void getCacheServers_isCanonical() {
         .isSameAs(gemFireCacheImpl.getCacheServers());
   }
 
+  @Test
+  public void testLockDiskStore() throws InterruptedException {
+    int nThread = 10;
+    String diskStoreName = "MyDiskStore";
+    AtomicInteger nTrue = new AtomicInteger();
+    AtomicInteger nFalse = new AtomicInteger();
+    ExecutorService executorService = Executors.newFixedThreadPool(nThread);
+    IntStream.range(0, nThread).forEach(tid -> {
+      executorService.submit(() -> {
+        try {
+          boolean lockResult = gemFireCacheImpl.doLockDiskStore(diskStoreName);
+          if (lockResult) {
+            nTrue.incrementAndGet();
+          } else {
+            nFalse.incrementAndGet();
+          }
+        } finally {
+          boolean unlockResult = 
gemFireCacheImpl.doUnlockDiskStore(diskStoreName);
+          if (unlockResult) {
+            nTrue.incrementAndGet();
+          } else {
+            nFalse.incrementAndGet();
+          }
+        }
+      });
+    });
+    executorService.shutdown();
+    executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);

Review comment:
       Will change it.




----------------------------------------------------------------
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