metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cestella <>
Subject [GitHub] incubator-metron pull request #210: METRON-366: Add MODEL_APPLY to Stellar
Date Fri, 19 Aug 2016 18:58:23 GMT
Github user cestella commented on a diff in the pull request:
    --- Diff: metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/
    @@ -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
         try {
           for(String name : serviceDiscovery.queryForNames()) {
             for(ServiceInstance<ModelEndpoint> endpoint: serviceDiscovery.queryForInstances(name))
               ModelEndpoint ep = endpoint.getPayload();
     "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 --
    It's hard for the author to make code easier to read that he did not intentionally make
hard to read..after all, I don't find my own code hard to read. :)
    That being said, that particular block of code is intended to update a map with the current
version of the model which has been discovered.  If you request a model without a version,
an instance of the most recent version will be returned.  I can, perhaps, use another variable
and put a comment.

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 or file a JIRA ticket
with INFRA.

View raw message