private void processSettings (HttpServletRequest request,
HttpServletResponse response,
HttpSession session)
throws IOException, ServletException {
CacheManager ehcacheManager = ((EhCacheProvider) SpringContextSingleton.getBean("ehCacheProvider")).getCacheManager();
if (request.getParameter ("flushAllCaches") != null) {
CacheHelper.flushAllCaches();
} else if (request.getParameter ("flushOutputCaches") != null) {
CacheHelper.flushOutputCaches();
} else if (request.getParameter ("flushHibernateCaches") != null) {
CacheHelper.flushHibernateCaches();
}
// get the cache factory instance
CacheService cacheFactory = ServicesRegistry.getInstance().getCacheService();
// get the registered cache names
Iterator cacheNameIte = cacheFactory.getNames ().iterator();
// for each cache..
while (cacheNameIte.hasNext()) {
// get the cache name
String curCacheName = (String)cacheNameIte.next ();
if (request.getParameter ("flush_" + curCacheName) != null) {
Cache cache = ServicesRegistry.getInstance().getCacheService().getCache (curCacheName);
if (cache != null) {
logger.info("Flushing cache: " + curCacheName);
cache.flush(false);
}
}
}
for (String cacheName : ehcacheManager.getCacheNames()) {
if (request.getParameter ("flush_ehcache_" + cacheName) != null) {
net.sf.ehcache.Cache cache = ehcacheManager.getCache(cacheName);
if (cache != null) {
logger.info("Flushing cache: " + cacheName);
// flush without notifying the other cluster nodes
cache.removeAll(true);
// reset statistics