[ 
https://issues.apache.org/jira/browse/GEODE-8099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17136018#comment-17136018
 ] 

ASF GitHub Bot commented on GEODE-8099:
---------------------------------------

jinmeiliao commented on a change in pull request #5188:
URL: https://github.com/apache/geode/pull/5188#discussion_r440316264



##########
File path: 
geode-core/src/test/java/org/apache/geode/management/internal/api/LocatorClusterManagementServiceTest.java
##########
@@ -125,16 +127,41 @@ public void before() throws Exception {
     doReturn(true).when(persistenceService).lockSharedConfiguration();
     doNothing().when(persistenceService).unlockSharedConfiguration();
     operationManager = mock(OperationManager.class);
+    dLockService = mock(DistributedLockService.class);
+
     service =
         spy(new LocatorClusterManagementService(cache, persistenceService, 
managers, validators,
             memberValidator, cacheElementValidator, operationManager));
+    doReturn(dLockService).when(service).getCmsDlockService();
 
     regionConfig = new Region();
     regionConfig.setName("region1");
 
     rebalanceOperation = new RebalanceOperation();
   }
 
+  @Test
+  public void lockAndUnlockCalledAtCreate() {
+    try {
+      service.create(regionConfig);
+    } catch (Exception ignore) {
+    }
+
+    
verify(dLockService).lock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME,
 -1, -1);
+    
verify(dLockService).unlock(LocatorClusterManagementService.CMS_DLOCK_SERVICE_NAME);
+  }
+
+  @Test
+  public void lockAndUnlockCalledAtDelete() {
+    try {
+      service.delete(regionConfig);
+    } catch (Exception ignore) {

Review comment:
       in this test setup, a NPE will already be thrown. This test is to make 
sure the two calls always get called when any exception happens. I changed the 
test method to be `lockAndUnlockCalledAtDeleteWithException`. And added the 
verification to another test setup when deletion is successful.




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


> Make ClusterConfiguration Service thread safe
> ---------------------------------------------
>
>                 Key: GEODE-8099
>                 URL: https://issues.apache.org/jira/browse/GEODE-8099
>             Project: Geode
>          Issue Type: Bug
>          Components: configuration
>            Reporter: Anilkumar Gingade
>            Priority: Major
>              Labels: GeodeOperationAPI
>             Fix For: 1.14.0
>
>
> When multiple cluster configuration clients (multiple rest clients) connects 
> and issue configuration commands, the cluster configuration should handle 
> concurrent request and modify/save/execute the configuration definition in 
> thread safe manner.  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to