/** * Sets the internal {@link #getCacheManager CacheManager} on any internal configured * {@link #getRealms Realms} that implement the {@link org.apache.shiro.cache.CacheManagerAware CacheManagerAware} interface. * <p/> * This method is called after setting a cacheManager on this securityManager via the * {@link #setCacheManager(org.apache.shiro.cache.CacheManager) setCacheManager} method to allow it to be propagated * down to all the internal Realms that would need to use it. * <p/> * It is also called after setting one or more realms via the {@link #setRealm setRealm} or * {@link #setRealms setRealms} methods to allow these newly available realms to be given the cache manager * already in use. */ protected void applyCacheManagerToRealms() { CacheManager cacheManager = getCacheManager(); Collection<Realm> realms = getRealms(); if (cacheManager != null && realms != null && !realms.isEmpty()) { for (Realm realm : realms) { if (realm instanceof CacheManagerAware) { ((CacheManagerAware) realm).setCacheManager(cacheManager); } } } }
/** * Sets the internal {@link #getCacheManager CacheManager} on any internal configured * {@link #getRealms Realms} that implement the {@link org.apache.shiro.cache.CacheManagerAware CacheManagerAware} interface. * <p/> * This method is called after setting a cacheManager on this securityManager via the * {@link #setCacheManager(org.apache.shiro.cache.CacheManager) setCacheManager} method to allow it to be propagated * down to all the internal Realms that would need to use it. * <p/> * It is also called after setting one or more realms via the {@link #setRealm setRealm} or * {@link #setRealms setRealms} methods to allow these newly available realms to be given the cache manager * already in use. */ protected void applyCacheManagerToRealms() { CacheManager cacheManager = getCacheManager(); Collection<Realm> realms = getRealms(); if (cacheManager != null && realms != null && !realms.isEmpty()) { for (Realm realm : realms) { if (realm instanceof CacheManagerAware) { ((CacheManagerAware) realm).setCacheManager(cacheManager); } } } }
/** * Sets the internal {@link #getCacheManager CacheManager} on any internal configured * {@link #getRealms Realms} that implement the {@link org.apache.shiro.cache.CacheManagerAware CacheManagerAware} interface. * <p/> * This method is called after setting a cacheManager on this securityManager via the * {@link #setCacheManager(org.apache.shiro.cache.CacheManager) setCacheManager} method to allow it to be propagated * down to all the internal Realms that would need to use it. * <p/> * It is also called after setting one or more realms via the {@link #setRealm setRealm} or * {@link #setRealms setRealms} methods to allow these newly available realms to be given the cache manager * already in use. */ protected void applyCacheManagerToRealms() { CacheManager cacheManager = getCacheManager(); Collection<Realm> realms = getRealms(); if (cacheManager != null && realms != null && !realms.isEmpty()) { for (Realm realm : realms) { if (realm instanceof CacheManagerAware) { ((CacheManagerAware) realm).setCacheManager(cacheManager); } } } }