You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "hua74ni (via GitHub)" <gi...@apache.org> on 2023/06/02 04:29:14 UTC

[GitHub] [shardingsphere] hua74ni opened a new pull request, #26007: Fixed the reloadRules method that caused ruleMetaData.getRules() to be null briefly

hua74ni opened a new pull request, #26007:
URL: https://github.com/apache/shardingsphere/pull/26007

   Changes proposed in this pull request:
     - Fixed the reloadRules method that caused ruleMetaData.getRules() to be null briefly
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] hua74ni commented on pull request #26007: Fixed the reloadRules method that caused ruleMetaData.getRules() to be null briefly

Posted by "hua74ni (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] hua74ni commented on pull request #26007: Fixed the reloadRules method that caused ruleMetaData.getRules() to be null briefly

Posted by "hua74ni (via GitHub)" <gi...@apache.org>.
hua74ni commented on PR #26007:
URL: https://github.com/apache/shardingsphere/pull/26007#issuecomment-1586776539

   @zhaojinchao95 Help review or make suggestions


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org