metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickwallen <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #210: METRON-366: Add MODEL_APPLY to Stellar
Date Fri, 19 Aug 2016 18:53:27 GMT
Github user nickwallen commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/210#discussion_r75534093
  
    --- Diff: metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java
---
    @@ -76,12 +92,19 @@ public void resetState() {
     
       private void updateState() {
         Map<Model, List<ModelEndpoint>> state = new HashMap<>();
    +    Map<String, String> modelToVersion = new HashMap<>();
         Map<String, ServiceInstance<ModelEndpoint>> containerToEndpoint = new
HashMap<>();
         try {
           for(String name : serviceDiscovery.queryForNames()) {
             for(ServiceInstance<ModelEndpoint> endpoint: serviceDiscovery.queryForInstances(name))
{
               ModelEndpoint ep = endpoint.getPayload();
               LOG.info("Found model endpoint " + ep);
    +          String currentVersion = modelToVersion.getOrDefault(ep.getName(), ep.getVersion());
    +          modelToVersion.put( ep.getName()
    +                            , currentVersion.compareTo(ep.getVersion()) < 0
    +                            ? ep.getVersion()
    +                            : currentVersion
    +                            );
    --- End diff --
    
    I am not sure that I totally understand what the intention here is.  I've had to stare
at this code block for like 10 minutes.  Is there no way to make this an easier read?  Just
my opinion; maybe I'm slow.


---
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