Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
funky-eyes committed Mar 18, 2024
1 parent 65e3dfc commit ce9d9c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.seata.common.ConfigurationKeys;
Expand Down Expand Up @@ -90,16 +88,14 @@ public void testCheckFailFast() throws Exception {
Mockito.when(resourceManager.getManagedResources()).thenReturn(resourceMap);
newClient.setResourceManager(resourceManager);
System.setProperty("file.listener.enabled", "true");
CountDownLatch countDownLatch = new CountDownLatch(1);
ConfigurationFactory.getInstance().addConfigListener(ConfigurationKeys.ENABLE_RM_CLIENT_CHANNEL_CHECK_FAIL_FAST, new CachedConfigurationChangeListener() {
@Override
public void onChangeEvent(ConfigurationChangeEvent event) {
logger.info("dataId:{}, value: {}, oldValue: {}", event.getDataId(), event.getNewValue(), event.getOldValue());
countDownLatch.countDown();
}
});
System.setProperty(ConfigurationKeys.ENABLE_RM_CLIENT_CHANNEL_CHECK_FAIL_FAST, "true");
countDownLatch.await(5, TimeUnit.SECONDS);
Thread.sleep(2000);
Assertions.assertThrows(FrameworkException.class, newClient::init);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -145,18 +144,16 @@ public void testCheckFailFast() throws Exception {
TmNettyRemotingClient.getInstance().destroy();
TmNettyRemotingClient tmClient = TmNettyRemotingClient.getInstance("fail_fast", "default_tx_group");
System.setProperty("file.listener.enabled", "true");
CountDownLatch countDownLatch = new CountDownLatch(1);
ConfigurationFactory.getInstance().addConfigListener(ConfigurationKeys.ENABLE_TM_CLIENT_CHANNEL_CHECK_FAIL_FAST,
new CachedConfigurationChangeListener() {
@Override
public void onChangeEvent(ConfigurationChangeEvent event) {
logger.info("dataId:{}, value: {}, oldValue: {}", event.getDataId(), event.getNewValue(),
event.getOldValue());
countDownLatch.countDown();
}
});
System.setProperty(ConfigurationKeys.ENABLE_TM_CLIENT_CHANNEL_CHECK_FAIL_FAST, "true");
countDownLatch.await(5, TimeUnit.SECONDS);
Thread.sleep(2000);
Assertions.assertThrows(FrameworkException.class, tmClient::init);
}

Expand Down

0 comments on commit ce9d9c4

Please sign in to comment.