コード例 #1
0
 @SuppressWarnings("unchecked")
 protected <KIn> Set<KIn> loadAllKeysFromCacheLoaderUsingFilter(Set<KIn> filterOutSet) {
   Set<KIn> keysInCL = InfinispanCollections.<KIn>emptySet();
   CacheLoader cl = resolveCacheLoader();
   if (cl != null) {
     try {
       keysInCL = (Set<KIn>) cl.loadAllKeys((Set<Object>) filterOutSet);
     } catch (CacheLoaderException e) {
       throw new CacheException("Could not load key/value entries from cacheloader", e);
     }
   }
   return keysInCL;
 }
コード例 #2
0
 @SuppressWarnings("unchecked")
 protected <KIn, KOut> KOut loadValueFromCacheLoader(KIn key) {
   KOut value = null;
   CacheLoader cl = resolveCacheLoader();
   if (cl != null) {
     try {
       InternalCacheEntry entry = cl.load(key);
       if (entry != null) {
         Object loadedValue = entry.getValue();
         if (loadedValue instanceof MarshalledValue) {
           value = (KOut) ((MarshalledValue) loadedValue).get();
         } else {
           value = (KOut) loadedValue;
         }
       }
     } catch (CacheLoaderException e) {
       throw new CacheException("Could not load key/value entries from cacheloader", e);
     }
   }
   return value;
 }