Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/977#discussion_r179871500 --- Diff: metron-analytics/metron-profiler-common/src/main/java/org/apache/metron/profiler/DefaultMessageDistributor.java --- @@ -262,11 +262,19 @@ public ProfileBuilder getBuilder(MessageRoute route, Context context) throws Exe /** * Builds the key that is used to lookup the {@link ProfileBuilder} within the cache. * + * <p>The cache key is built using the hash codes of the profile and entity name. If the profile + * definition is ever changed, the same cache entry will not be reused. This ensures that no + * state can be carried over from the old definition into the new, which might result in an + * invalid profile measurement. + * * @param profile The profile definition. * @param entity The entity. */ - private String cacheKey(ProfileConfig profile, String entity) { - return format("%s:%s", profile, entity); + private int cacheKey(ProfileConfig profile, String entity) { + return new HashCodeBuilder(17, 37) --- End diff -- Thanks for the explanation @nickwallen, makes sense.
---