/** * Tokenize the given path pattern into parts, based on this matcher's settings. * <p>Performs caching based on {@link #setCachePatterns}, delegating to * {@link #tokenizePath(String)} for the actual tokenization algorithm. * @param pattern the pattern to tokenize * @return the tokenized pattern parts */ protected String[] tokenizePattern(String pattern) { String[] tokenized = null; Boolean cachePatterns = this.cachePatterns; if (cachePatterns == null || cachePatterns.booleanValue()) { tokenized = this.tokenizedPatternCache.get(pattern); } if (tokenized == null) { tokenized = tokenizePath(pattern); if (cachePatterns == null && this.tokenizedPatternCache.size() >= CACHE_TURNOFF_THRESHOLD) { // Try to adapt to the runtime situation that we're encountering: // There are obviously too many different patterns coming in here... // So let's turn off the cache since the patterns are unlikely to be reoccurring. deactivatePatternCache(); return tokenized; } if (cachePatterns == null || cachePatterns.booleanValue()) { this.tokenizedPatternCache.put(pattern, tokenized); } } return tokenized; }
String[] pathDirs = tokenizePath(path);