protected Cache getCache() {
   if (manager == null
       || Status.STATUS_SHUTDOWN.equals(manager.getStatus())
       || cache == null
       || !Status.STATUS_ALIVE.equals(cache.getStatus())) {
     cache = createCache();
   } else {
     cache = getManager().getCache(cacheId);
   }
   return cache;
 }
Exemplo n.º 2
0
 /**
  * Adapt the {@link net.sf.ehcache.Status} to the matching {@link Status}
  *
  * @param status the status to adapt
  * @return a Status that matches the lifecycle phase of the ehcache-specific status
  */
 public static Status adaptStatus(net.sf.ehcache.Status status) {
   if (status.intValue() == net.sf.ehcache.Status.STATUS_ALIVE.intValue()) {
     return Status.STARTED;
   }
   if (status.intValue() == net.sf.ehcache.Status.STATUS_UNINITIALISED.intValue()) {
     return Status.UNINITIALISED;
   }
   if (status.intValue() == net.sf.ehcache.Status.STATUS_SHUTDOWN.intValue()) {
     return Status.STOPPED;
   }
   return Status.UNINITIALISED;
 }
 public CacheManager getManager() {
   if (manager == null || Status.STATUS_SHUTDOWN.equals(manager.getStatus())) {
     manager = CacheManager.create();
   }
   return manager;
 }