[ https://issues.apache.org/jira/browse/GEODE-8099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17135984#comment-17135984 ]
ASF GitHub Bot commented on GEODE-8099: --------------------------------------- kirklund commented on a change in pull request #5188: URL: https://github.com/apache/geode/pull/5188#discussion_r440286551 ########## 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) { Review comment: Is create expected to throw some Exception every time this test runs? If not, then let's remove the try-catch and add `throws Exception` clause to the method. ########## 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: Can we remove try-block and use `throws Exception`? ########## File path: geode-core/src/main/java/org/apache/geode/management/internal/api/LocatorClusterManagementService.java ########## @@ -154,6 +163,24 @@ public LocatorClusterManagementService( this.operationManager = operationManager; } + @VisibleForTesting + DistributedLockService getCmsDlockService() { Review comment: This method should be `synchronized` since cmsDlockService is lazy initialized. ---------------------------------------------------------------- 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)