private void outOfCacheCapacity ( ) { synchronized ( knownPatterns ) { if ( knownPatterns . size ( ) > MAX_PATTERNS_PER_LOG ) { logger . warn ( "out of capacity in RateLimitedLog registry; accidentally " + "using interpolated strings as patterns?" ) ; registry . flush ( ) ; knownPatterns . clear ( ) ; } } }
We ve run out of capacity in our cache of RateLimitedLogWithPattern objects . This probably means that the caller is accidentally calling us with an already - interpolated string instead of using the pattern as the key and letting us do the interpolation . Don t lose data ; instead fall back to flushing the entire cache but carrying on . The worst - case scenario here is that we flush the logs far more frequently than their requested durations potentially allowing the logging to impact throughput but we don t lose any log data .