apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amberarrow <...@git.apache.org>
Subject [GitHub] incubator-apex-malhar pull request: APEXMALHAR-2084-Fixed getters ...
Date Mon, 16 May 2016 18:59:34 GMT
Github user amberarrow commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-malhar/pull/275#discussion_r63406074
  
    --- Diff: kafka/src/main/java/org/apache/apex/malhar/kafka/AbstractKafkaInputOperator.java
---
    @@ -413,33 +413,39 @@ public int getInitialPartitionCount()
         return initialPartitionCount;
       }
     
    -  public void setClusters(String clusters)
    -  {
    -    this.clusters = clusters.split(";");
    -  }
    -
       /**
        *  Same setting as bootstrap.servers property to KafkaConsumer
        *  refer to http://kafka.apache.org/documentation.html#newconsumerconfigs
    -   *  To support multi cluster, you can have multiple bootstrap.servers separated by
";"
    +   *  To support multi cluster, you can have multiple elements in the array
        */
    -  public String getClusters()
    +  public void setClusters(String[] clusters)
       {
    -    return Joiner.on(';').join(clusters);
    +    this.clusters = clusters;
       }
     
    -  public void setTopics(String topics)
    +  public String[] getClusters()
       {
    -    this.topics = Iterables.toArray(Splitter.on(',').trimResults().omitEmptyStrings().split(topics),
String.class);
    +    return clusters;
       }
     
       /**
    -   * The topics the operator consumes, separate by','
    +   * The topics the operator consumes
        * Topic name can only contain ASCII alphanumerics, '.', '_' and '-'
        */
    -  public String getTopics()
    +  public void setTopics(String[] topics)
    +  {
    --- End diff --
    
    You can avoid creation of the intermediate ArrayList and compact the array in place with
something like this but
    feel free to ignore if you like the original better:
    {code}
    int j = 0, len = topics.length;
    for (int i = 0; i < len; ++i) {
        if (null == topics[i] || 0 == topics[i].length()) continue;
        if (i != j) topics[j] = topics[i];
        ++j;
    }
    this.topics = Arrays.copyOfRange(topics, 0, j);
    {code}



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message