Examples of CacheLoader


Examples of org.infinispan.loaders.CacheLoader

      }
      return value;
   }
  
   protected CacheLoader resolveCacheLoader(){
      CacheLoader cl = null;
      if (cacheLoaderManager != null && cacheLoaderManager.isEnabled()){
         cl = cacheLoaderManager.getCacheLoader();
      }
      return cl;
   }
View Full Code Here

Examples of org.infinispan.loaders.CacheLoader

      if (loader instanceof LegacyLoaderAdapter<?>) {
         return ((LegacyLoaderAdapter<?>)loader).adapt();
      } else if (loader instanceof CacheStoreConfiguration) {
         if (loader instanceof LegacyStoreConfiguration) {
            LegacyStoreConfiguration store = (LegacyStoreConfiguration) loader;
            CacheLoader cacheStore = store.cacheStore(); // TODO: in 6.0, as we deprecate the LegacyConfigurationLoader#cacheLoader() method, narrow this type to CacheStore
            clc = getLoaderConfig(loader, cacheStore);
         }
         CacheStoreConfig csc = (CacheStoreConfig) clc;
         CacheStoreConfiguration store = (CacheStoreConfiguration) loader;
         adapt(store, csc);
      } else if (loader instanceof LegacyLoaderConfiguration) {
         CacheLoader cacheLoader = ((LegacyLoaderConfiguration) loader).cacheLoader();
         clc = getLoaderConfig(loader, cacheLoader);
      }
      if (clc instanceof AbstractCacheStoreConfig) {
         AbstractCacheStoreConfig acsc = (AbstractCacheStoreConfig) clc;
         Properties p = loader.properties();
View Full Code Here

Examples of org.infinispan.loaders.CacheLoader

         }
      }
   }

   private void parseLoader(XMLStreamReader reader, ConfigurationBuilder builder, ClassLoader cl) throws XMLStreamException {
      CacheLoader loader = null;
      Boolean fetchPersistentState = null;
      Boolean ignoreModifications = null;
      Boolean purgeOnStartup = null;
      Integer purgerThreads = null;
      Boolean purgeSynchronously = null;
View Full Code Here

Examples of org.infinispan.loaders.CacheLoader

      }
   }

   private void parseLoader(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException {
     ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder();
      CacheLoader loader = null;
      Boolean fetchPersistentState = null;
      Boolean ignoreModifications = null;
      Boolean purgeOnStartup = null;
      Integer purgerThreads = null;
      Boolean purgeSynchronously = null;
View Full Code Here

Examples of org.infinispan.loaders.spi.CacheLoader

      List<T> loaders;
      if (loader instanceof ChainingCacheStore) {
         ChainingCacheStore ccs = (ChainingCacheStore) loader;
         loaders = ccs.getCacheLoaders(loaderClass);
      } else {
         CacheLoader cl = undelegateCacheLoader(loader);
         if (loaderClass.isInstance(cl)) {
            loaders = Collections.singletonList((T) cl);
         } else {
            loaders = Collections.emptyList();
         }
View Full Code Here

Examples of org.infinispan.loaders.spi.CacheLoader

         }
      }
   }

   CacheLoader createCacheLoader() throws Exception {
      CacheLoader tmpLoader;
      // if we only have a single cache loader configured in the chaining cacheloader then
      // don't use a chaining cache loader at all.
      // also if we are using passivation then just directly use the first cache loader.
      if (clmConfig.usingChainingCacheLoader()) {
         // create chaining cache loader.
         ChainingCacheStore ccl = new ChainingCacheStore();
         tmpLoader = ccl;

         // only one cache loader may have fetchPersistentState to true.
         int numLoadersWithFetchPersistentState = 0;
         for (CacheLoaderConfiguration cfg : clmConfig.cacheLoaders()) {
            if (cfg instanceof CacheStoreConfiguration) {
               CacheStoreConfiguration scfg = (CacheStoreConfiguration) cfg;
               assertNotSingletonAndShared(scfg);
               if(scfg.fetchPersistentState()) numLoadersWithFetchPersistentState++;
            }
            if (numLoadersWithFetchPersistentState > 1)
               throw log.multipleCacheStoresWithFetchPersistentState();

            CacheLoader l = createCacheLoader(cfg, cache);
            ccl.addCacheLoader(l);
         }
      } else {
         if (!clmConfig.cacheLoaders().isEmpty()) {
            CacheLoaderConfiguration cfg = clmConfig.cacheLoaders().get(0);
View Full Code Here

Examples of org.infinispan.loaders.spi.CacheLoader

   CacheLoader createCacheLoader(CacheLoaderConfiguration cfg, AdvancedCache<Object, Object> cache) throws Exception {
      ConfigurationFor annotation = cfg.getClass().getAnnotation(ConfigurationFor.class);
      if (annotation == null) {
         throw log.loaderConfigurationDoesNotSpecifyLoaderClass(cfg.getClass().getName());
      }
      CacheLoader tmpLoader = (CacheLoader) Util.getInstance(annotation.value());

      if (tmpLoader != null) {
         if (cfg instanceof CacheStoreConfiguration) {
            CacheStore tmpStore = (CacheStore) tmpLoader;
            // async?
            CacheStoreConfiguration cfg2 = (CacheStoreConfiguration) cfg;
            if (cfg2.async().enabled()) {
               tmpStore = createAsyncStore(tmpStore);
               tmpLoader = tmpStore;
            }

            // read only?
            if (cfg2.ignoreModifications()) {
               tmpStore = new ReadOnlyStore(tmpStore);
               tmpLoader = tmpStore;
            }

            // singleton?
            if (cfg2.singletonStore().enabled()) {
               tmpStore = new SingletonStore(tmpStore, cache);
               tmpLoader = tmpStore;
            }
         }

         // load props
         tmpLoader.init(cfg, cache, m);
      }
      return tmpLoader;
   }
View Full Code Here

Examples of org.infinispan.loaders.spi.CacheLoader

   }

   @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;
View Full Code Here

Examples of org.infinispan.loaders.spi.CacheLoader

   }

   @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 {
View Full Code Here

Examples of org.infinispan.loaders.spi.CacheLoader

      }
      return value;
   }

   protected CacheLoader resolveCacheLoader(){
      CacheLoader cl = null;
      if (cacheLoaderManager != null && cacheLoaderManager.isEnabled()){
         cl = cacheLoaderManager.getCacheLoader();
      }
      return cl;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.