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

    https://github.com/apache/metron/pull/1040#discussion_r192221092
  
    --- Diff: 
metron-platform/metron-solr/src/main/java/org/apache/metron/solr/dao/SolrDao.java
 ---
    @@ -134,13 +134,30 @@ public void patch(RetrieveLatestDao 
retrieveLatestDao, PatchRequest request,
         return this.solrColumnMetadataDao.getColumnMetadata(indices);
       }
     
    -  public SolrClient getSolrClient(String zkHost) {
    -    return new CloudSolrClient.Builder().withZkHost(zkHost).build();
    +  /**
    +   * Builds a Solr client using the ZK hosts from the global config.
    +   * @return SolrClient
    +   */
    +  public SolrClient getSolrClient() {
    +    return new CloudSolrClient.Builder().withZkHost(getZkHosts()).build();
       }
     
    -  public String getZkHost() {
    +  /**
    +   * Builds a Solr client using the ZK hosts specified.
    +   * @return SolrClient
    +   */
    +  public SolrClient getSolrClient(List<String> zkHosts) {
    +    return new CloudSolrClient.Builder().withZkHost(zkHosts).build();
    +  }
    +
    +  /**
    +   * Get ZK hosts from the global config.
    +   * @return List of ZkHosts
    +   */
    +  public List<String> getZkHosts() {
         Map<String, Object> globalConfig = 
accessConfig.getGlobalConfigSupplier().get();
    -    return (String) globalConfig.get("solr.zookeeper");
    +    String solrZookeeper = (String) globalConfig.get("solr.zookeeper");
    +    return Arrays.asList(solrZookeeper.split(","));
    --- End diff --
    
    Have you tried this when people put a space between the nodes?  Perhaps 
something like 
`Lists.newArrayList(Iterables.transform(Splitter.on(",").split(globalConfig.getOrDefault("solr.zookeeper",
 ""), x -> x.trim()));`
    
    
    Also, `solr.zookeeper` should be a constant.


---

Reply via email to