Github user nickwallen commented on a diff in the pull request:
https://github.com/apache/metron/pull/947#discussion_r172866140
--- Diff:
metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/JoinBolt.java
---
@@ -89,29 +91,25 @@ public void prepare(Map map, TopologyContext
topologyContext, OutputCollector ou
if (this.maxTimeRetain == null) {
throw new IllegalStateException("maxTimeRetain must be specified");
}
- loader = new CacheLoader<String, Map<String, Tuple>>() {
- @Override
- public Map<String, Tuple> load(String key) throws Exception {
- return new HashMap<>();
- }
- };
- cache = CacheBuilder.newBuilder().maximumSize(maxCacheSize)
- .expireAfterWrite(maxTimeRetain,
TimeUnit.MINUTES).removalListener(new JoinRemoveListener())
- .build(loader);
+ loader = s -> new HashMap<>();
+ cache = Caffeine.newBuilder().maximumSize(maxCacheSize)
+ .expireAfterWrite(maxTimeRetain, TimeUnit.MINUTES)
+ .removalListener(new JoinRemoveListener())
--- End diff --
It seems like we only want notified of a full cache when ERROR logging is
set. Is that the case? In the `JoinRemoveListener` we end up doing some work
that we probably don't need to do unless ERROR logging is set. One easy fix
would be to only add the "remove listener" if `LOG.isDebugEnabled()`.
---