Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.StoreConfiguration


         // only one cache loader may have fetchPersistentState to true.
         int numLoadersWithFetchPersistentState = 0;
         for (LoaderConfiguration cfg : clmConfig.cacheLoaders()) {
            if (cfg instanceof StoreConfiguration) {
               StoreConfiguration scfg = (StoreConfiguration) cfg;
               assertNotSingletonAndShared(scfg);
               if(scfg.fetchPersistentState()) numLoadersWithFetchPersistentState++;
            }
            if (numLoadersWithFetchPersistentState > 1)
               throw new Exception("Invalid cache loader configuration!!  Only ONE cache loader may have fetchPersistentState set to true.  Cache will not start!");

            CacheLoader l = createCacheLoader(LegacyConfigurationAdaptor.adapt(cfg), cache);
View Full Code Here


      storesMutex.readLock().lock();
      try {
         boolean activated = false;
         for (CacheWriter w : writers) {
            StoreConfiguration conf = configMap.get(w);
            if (!conf.shared()) {
               activated = w.delete(key);
            }
         }
         return activated;
      } finally {
View Full Code Here

   @Override
   public AdvancedCacheLoader getStateTransferProvider() {
      storesMutex.readLock().lock();
      try {
         for (CacheLoader l : loaders) {
            StoreConfiguration storeConfiguration = configMap.get(l);
            if (storeConfiguration.fetchPersistentState() && !storeConfiguration.shared())
               return (AdvancedCacheLoader) l;
         }
         return null;
      } finally {
         storesMutex.readLock().unlock();
View Full Code Here

      storesMutex.readLock().lock();
      try {
         boolean activated = false;
         for (CacheWriter w : writers) {
            StoreConfiguration conf = configMap.get(w);
            if (!conf.shared()) {
               activated = w.delete(key);
            }
         }
         return activated;
      } finally {
View Full Code Here

   @Override
   public AdvancedCacheLoader getStateTransferProvider() {
      storesMutex.readLock().lock();
      try {
         for (CacheLoader l : loaders) {
            StoreConfiguration storeConfiguration = configMap.get(l);
            if (storeConfiguration.fetchPersistentState() && !storeConfiguration.shared())
               return (AdvancedCacheLoader) l;
         }
         return null;
      } finally {
         storesMutex.readLock().unlock();
View Full Code Here

      if (loader instanceof CacheStore) stores.put((CacheStore) loader, (StoreConfiguration) config);
   }

   public void purgeIfNecessary() throws CacheLoaderException {
      for (Map.Entry<CacheStore, StoreConfiguration> e : stores.entrySet()) {
         StoreConfiguration value = e.getValue();
         if (value.purgeOnStartup())
            e.getKey().clear();
      }
   }
View Full Code Here

         // only one cache loader may have fetchPersistentState to true.
         int numLoadersWithFetchPersistentState = 0;
         for (LoaderConfiguration cfg : clmConfig.cacheLoaders()) {
            if (cfg instanceof StoreConfiguration) {
               StoreConfiguration scfg = (StoreConfiguration) cfg;
               assertNotSingletonAndShared(scfg);
               if(scfg.fetchPersistentState()) numLoadersWithFetchPersistentState++;
            }
            if (numLoadersWithFetchPersistentState > 1)
               throw new Exception("Invalid cache loader configuration!!  Only ONE cache loader may have fetchPersistentState set to true.  Cache will not start!");

            CacheLoader l = createCacheLoader(LegacyConfigurationAdaptor.adapt(cfg), cache);
View Full Code Here

   public void purgeIfNecessary() throws CacheLoaderException {
      loadersAndStoresMutex.readLock().lock();
      try {
         for (Map.Entry<CacheStore, StoreConfiguration> e : stores.entrySet()) {
            StoreConfiguration value = e.getValue();
            if (value.purgeOnStartup())
               e.getKey().clear();
         }
      } finally {
         loadersAndStoresMutex.readLock().unlock();
      }
View Full Code Here

         // only one cache loader may have fetchPersistentState to true.
         int numLoadersWithFetchPersistentState = 0;
         for (LoaderConfiguration cfg : clmConfig.cacheLoaders()) {
            if (cfg instanceof StoreConfiguration) {
               StoreConfiguration scfg = (StoreConfiguration) cfg;
               assertNotSingletonAndShared(scfg);
               if(scfg.fetchPersistentState()) numLoadersWithFetchPersistentState++;
            }
            if (numLoadersWithFetchPersistentState > 1)
               throw new Exception("Invalid cache loader configuration!!  Only ONE cache loader may have fetchPersistentState set to true.  Cache will not start!");

            CacheLoader l = createCacheLoader(LegacyConfigurationAdaptor.adapt(cfg), cache);
View Full Code Here

      GlobalConfiguration globalConfig = new GlobalConfigurationBuilder().globalJmxStatistics().transport().defaultTransport().build();

      Configuration cacheConfig = new ConfigurationBuilder().persistence().addStore(LevelDBStoreConfigurationBuilder.class).location(tmpDataDirectory)
            .expiredLocation(tmpExpiredDirectory).implementationType(LevelDBStoreConfiguration.ImplementationType.AUTO).build();

      StoreConfiguration cacheLoaderConfig = cacheConfig.persistence().stores().get(0);
      assertTrue(cacheLoaderConfig instanceof LevelDBStoreConfiguration);
      LevelDBStoreConfiguration leveldbConfig = (LevelDBStoreConfiguration) cacheLoaderConfig;
      assertEquals(tmpDataDirectory, leveldbConfig.location());
      assertEquals(tmpExpiredDirectory, leveldbConfig.expiredLocation());
View Full Code Here

TOP

Related Classes of org.infinispan.configuration.cache.StoreConfiguration

Copyright © 2018 www.massapicom. 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.