dlmarion opened a new pull request, #40:
URL: https://github.com/apache/accumulo-classloaders/pull/40

   The two Caffeine Caches in the DeduplicationCache were not removing the 
entries. The addition of the `Scheduler` to the `expireAfterAccessStrongRefs` 
cache is necessary because the cleanup may only occur if the 
`expireAfterAccessStrongRefs` is modified by adding another classloader. If 
this does not occur for some time, then the cleanup eviction will not occur. 
This behavior is noted in the Caffeine javadoc:
   
     ```
     If expireAfter, expireAfterWrite, or expireAfterAccess is requested,
     then entries may be evicted on each cache modification, on occasional
     cache accesses, or on calls to Cache.cleanUp. A scheduler(Scheduler)
     may be specified to provide prompt removal of expired entries rather
     than waiting until activity triggers the periodic maintenance."
     ```
   
   The addition of the `canonicalWeakValuesCache.cleanUp()` call in the 
`anyMatch` method was required to remove the entry from the 
`canonicalWeakValuesCache`. The value is null due to weakValues, but since the 
entry has not been cleaned up, the call to `.asMap.keySet()` still returns the 
key. It's possible that using the same Scheduler approach may work here, but 
that may introduce a race condition. Another possible approach would be to 
register a Cleaner as documented at 
https://github.com/ben-manes/caffeine/wiki/Cleanup.


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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to