Skip to content

Make SentinelConfig.loadProps thread safe - #706

Merged
sczyh30 merged 1 commit into
alibaba:masterfrom
jasonjoo2010:sentinelConfigThreadSafe
Apr 25, 2019
Merged

Make SentinelConfig.loadProps thread safe#706
sczyh30 merged 1 commit into
alibaba:masterfrom
jasonjoo2010:sentinelConfigThreadSafe

Conversation

@jasonjoo2010

Copy link
Copy Markdown
Collaborator

Describe what this PR does / why we need it

Make SentinelConfig.loadProps thread safe

Does this pull request fix one issue?

Related to #705

Describe how you did it

Make snapshot of System.properties

Describe how to verify it

public class DashboardApplication {

    public static void main(String[] args) {
        new Thread() {
            public void run() {
                for (int i = 0; i < 10000; i ++) {
                    System.setProperty("prefix-" + i, "test");
                    try {
                        sleep(1);
                    } catch (InterruptedException e) {
                    }
                }
            }
        }.start();
        triggerSentinelInit();
        SpringApplication.run(DashboardApplication.class, args);
    }

    private static void triggerSentinelInit() {
        new Thread(() -> InitExecutor.doInit()).start();
    }
}

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #706 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #706   +/-   ##
========================================
  Coverage      40.4%   40.4%           
+ Complexity     1312    1311    -1     
========================================
  Files           297     297           
  Lines          8591    8591           
  Branches       1156    1156           
========================================
  Hits           3471    3471           
  Misses         4695    4695           
  Partials        425     425
Impacted Files Coverage Δ Complexity Δ
...om/alibaba/csp/sentinel/config/SentinelConfig.java 51.61% <100%> (ø) 14 <0> (ø) ⬇️
...ava/com/alibaba/csp/sentinel/node/ClusterNode.java 95.23% <0%> (-4.77%) 7% <0%> (-1%)
...m/alibaba/csp/sentinel/log/DateFileLogHandler.java 54.54% <0%> (-3.04%) 6% <0%> (-1%)
...a/csp/sentinel/slots/statistic/base/LeapArray.java 70.58% <0%> (+2.94%) 34% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 346e9b2...7dad7a8. Read the comment docs.

@sczyh30 sczyh30 added area/configuration Issues or PRs related to configurations of Sentinel to-review To review labels Apr 25, 2019

@sczyh30 sczyh30 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30
sczyh30 merged commit ecf4822 into alibaba:master Apr 25, 2019
@sczyh30

sczyh30 commented Apr 25, 2019

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/configuration Issues or PRs related to configurations of Sentinel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants