[ 
https://issues.apache.org/jira/browse/SCB-526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16461928#comment-16461928
 ] 

ASF GitHub Bot commented on SCB-526:
------------------------------------

wujimin commented on a change in pull request #681: [SCB-526]fetch once from 
dynamic config source when boot up
URL: 
https://github.com/apache/incubator-servicecomb-java-chassis/pull/681#discussion_r185695638
 
 

 ##########
 File path: 
demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/PojoClient.java
 ##########
 @@ -102,22 +102,32 @@ public static void run() throws Exception {
       ArchaiusUtils.setProperty("cse.loadbalance.strategy.name", 
"WeightedResponse");
       testStringArray(test);
       boolean checkerStated = false;
-      Set<Thread> allThreads = Thread.getAllStackTraces().keySet();
-      for (Thread t : allThreads) {
-        if (t.getName().equals("NFLoadBalancer-serverWeightTimer-unknown")) {
-          checkerStated = true;
+      // Timer may not start thread very fast so check for 3 times.
+      for (int i = 0; i < 3; i++) {
+        Set<Thread> allThreads = Thread.getAllStackTraces().keySet();
 
 Review comment:
   java.lang.Thread#getThreads is cheaper

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> When creating dynamic configuration, we need to fetch once for the 
> configuration when startup
> ---------------------------------------------------------------------------------------------
>
>                 Key: SCB-526
>                 URL: https://issues.apache.org/jira/browse/SCB-526
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>            Reporter: liubao
>            Assignee: liubao
>            Priority: Major
>
> Currently, dynamic config is fetched asynchronously, and when users use 
> dynamic configuration for following scenario will fail:
>  # make some environment, e.g. credentials
>  # spring @Value mechanism
> and so on. 
>  
> When users put these configurations to some dynamic configuration server, 
> they can assume server is running OK, and if try to fetch will give the 
> correct response. 
>  
> So it's very useful to fetch configurations once when boot up. 
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to