use of org.apache.sling.scripting.core.impl.helper.CachingMap in project sling by apache.
the class ScriptCacheImpl method activate.
@Activate
protected void activate(ScriptCacheImplConfiguration configuration, BundleContext bundleCtx) {
threadPool = threadPoolManager.get("Script Cache Thread Pool");
bundleContext = bundleCtx;
additionalExtensions = configuration.org_apache_sling_scripting_cache_additional__extensions();
int newMaxCacheSize = configuration.org_apache_sling_scripting_cache_size();
if (newMaxCacheSize != DEFAULT_CACHE_SIZE) {
// change the map only if there's a configuration change regarding the cache's max size
CachingMap<CachedScript> newMap = new CachingMap<>(newMaxCacheSize);
newMap.putAll(internalMap);
internalMap = newMap;
}
ResourceResolver resolver = null;
try {
resolver = rrf.getServiceResourceResolver(null);
searchPaths = resolver.getSearchPath();
} catch (LoginException e) {
LOGGER.error("Unable to retrieve a ResourceResolver for determining the search paths.", e);
} finally {
if (resolver != null) {
resolver.close();
}
}
configureCache();
active = true;
}
Aggregations