You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by GitBox <gi...@apache.org> on 2019/04/02 00:07:47 UTC

[GitHub] [metron] mmiklavc commented on a change in pull request #1367: METRON-2022: Metron rest creates large number of connections to ZK which causes subsequent connection to zk fail

mmiklavc commented on a change in pull request #1367: METRON-2022: Metron rest creates large number of connections to ZK which causes subsequent connection to zk fail
URL: https://github.com/apache/metron/pull/1367#discussion_r271093929
 
 

 ##########
 File path: metron-platform/metron-solr/src/main/java/org/apache/metron/solr/dao/SolrMetaAlertDao.java
 ##########
 @@ -144,10 +144,11 @@ protected String getDefaultSourceTypeField() {
       }
     };
 
-    SolrClient solrClient = solrDao.getSolrClient(solrDao.getZkHosts());
+    SolrClient solrClient = solrDao.getSolrClient();
 
 Review comment:
   Per @justinleet's comments, I think we should get rid of `getSolrClient()` from the SolrDao. It's not "dangerous" specifically in this case, but it makes it harder for someone else to come along later and understand where the client connections are coming from, how they're being created, and how many there will be. We just need to share a single instance at construction time, or per the issue you cited regarding runtime deps, inject singletons.
   
   The real solution here is to refactor this using traditional GOF patterns and simply use the abstract factory pattern as that's exactly its purpose - https://en.wikipedia.org/wiki/Abstract_factory_pattern. I think it's arguably out of scope for a bug fix if you don't want to do it, but that's my cents on what the best approach would be. Mind you, the DAO combining part might need some thought, but I suspect we can simplify it just fine.

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


With regards,
Apache Git Services