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

ASF GitHub Bot commented on STRATOS-1632:
-----------------------------------------

Github user Jasintha commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/496#discussion_r63987283
  
    --- Diff: 
components/org.apache.stratos.common/src/test/java/org/apache/stratos/common/test/ThriftClientConfigParserTest.java
 ---
    @@ -44,48 +43,58 @@ public void testThriftClientConfigParser() throws 
Exception {
             URL configFileUrl = 
ThriftClientConfigParserTest.class.getResource("/thrift-client-config.xml");
             
System.setProperty(ThriftClientConfig.THRIFT_CLIENT_CONFIG_FILE_PATH, 
configFileUrl.getPath());
             ThriftClientConfig thriftClientConfig = 
ThriftClientConfig.getInstance();
    -        List <ThriftClientInfo> cepList = 
thriftClientConfig.getThriftClientInfo(
    +        List<ThriftClientInfo> cepList = 
thriftClientConfig.getThriftClientInfo(
                     ThriftClientConfig.CEP_THRIFT_CLIENT_NAME);
    -        List <ThriftClientInfo> dasList = 
thriftClientConfig.getThriftClientInfo(
    +        List<ThriftClientInfo> dasList = 
thriftClientConfig.getThriftClientInfo(
                     ThriftClientConfig.DAS_THRIFT_CLIENT_NAME);
             ThriftClientInfo cepNode1 = null;
             ThriftClientInfo cepNode2 = null;
             ThriftClientInfo dasNode1 = null;
    -        
    +        ThriftClientInfo dasNode2 = null;
    +
             for (ThriftClientInfo cepNodeInfo : cepList) {
    -                   if(cepNodeInfo.getId().equals("node-01")) {
    -                           cepNode1 = cepNodeInfo;
    -                   }else if(cepNodeInfo.getId().equals("node-02")) {
    -                           cepNode2 = cepNodeInfo;
    -                   }
    -           }
    -                
    +            if (cepNodeInfo.getId().equals("node-01")) {
    --- End diff --
    
    better to use constant first approach when doing string comparison to avoid 
the NPE , ex 
    if("node-01".equals(cepNodeInfo.getId()))


> DataPublisher objects are created for nodes which has statsPublisherEnabled 
> set to false in thrift-client-config.xml
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: STRATOS-1632
>                 URL: https://issues.apache.org/jira/browse/STRATOS-1632
>             Project: Stratos
>          Issue Type: Bug
>    Affects Versions: 4.1.4
>            Reporter: Thanuja Uruththirakodeeswaran
>            Assignee: Thanuja Uruththirakodeeswaran
>             Fix For: 4.1.5
>
>
>  When we have enabled stats publishing for one node and disabled for another 
> node in thrift-client-config.xml file, Stratos is trying to publish data to 
> both nodes. This is because when creating load balancing type data publisher, 
> it is creating DataPublisher for ThriftClientInfo object which has false 
> value set to statsPublisherEnabled attribute.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to