slievrly commented on code in PR #6420:
URL: https://github.com/apache/incubator-seata/pull/6420#discussion_r1527194266


##########
config/seata-config-core/src/test/java/org/apache/seata/config/FileConfigurationTest.java:
##########
@@ -41,13 +41,17 @@ void addConfigListener() throws InterruptedException {
         Configuration fileConfig = ConfigurationFactory.getInstance();
         CountDownLatch countDownLatch = new CountDownLatch(1);
         boolean value = 
fileConfig.getBoolean("service.disableGlobalTransaction");
-        
ConfigurationCache.addConfigListener("service.disableGlobalTransaction", 
(event) -> {
-            Assertions.assertEquals(Boolean.parseBoolean(event.getNewValue()), 
!Boolean.parseBoolean(event.getOldValue()));
-            countDownLatch.countDown();
+        fileConfig.addConfigListener("service.disableGlobalTransaction", new 
CachedConfigurationChangeListener() {
+            @Override
+            public void onChangeEvent(ConfigurationChangeEvent event) {
+                
Assertions.assertEquals(Boolean.parseBoolean(event.getNewValue()), 
!Boolean.parseBoolean(event.getOldValue()));
+                countDownLatch.countDown();
+            }
         });
         System.setProperty("service.disableGlobalTransaction", 
String.valueOf(!value));
         countDownLatch.await(5, TimeUnit.SECONDS);
         System.setProperty("file.listener.enabled", "false");
+        Thread.sleep(1000);

Review Comment:
   For thread safety, the following sleep of 2 seconds is meaningless.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to