hua74ni commented on PR #26007:
URL: https://github.com/apache/shardingsphere/pull/26007#issuecomment-1573207264
Test cases
```
@Test
public void assertTest() throws InterruptedException {
ShardingSphereRuleMetaData ruleMetaData = new
ShardingSphereRuleMetaData(Collections.singleton(new
ShardingSphereRuleFixture()));
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
System.out.println("start cycle get ruleMetaData rules...");
while (true) {
if (CollectionUtils.isEmpty(ruleMetaData.getRules())) {
System.out.println("ruleMetaData rules is null!!!!");
}
}
}
});
thread.setDaemon(true);
thread.start();
Thread.sleep(1000);
boolean flag = false;
System.out.println("start replace all ruleMetaData rules...");
if (flag) {
((CopyOnWriteArrayList)
ruleMetaData.getRules()).replaceAll(shardingSphereRule -> {
return new ShardingSphereRuleFixture();
});
} else {
ShardingSphereRuleMetaData newRuleMetaData = new
ShardingSphereRuleMetaData(Collections.singleton(new
ShardingSphereRuleFixture()));
ruleMetaData.getRules().clear();
ruleMetaData.getRules().addAll(newRuleMetaData.getRules());
}
System.out.println("finished replace all ruleMetaData rules...");
Thread.sleep(3000);
}
```
--
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]