Package org.infinispan.loaders

Examples of org.infinispan.loaders.CacheStoreConfig


            loaderBuilder = fcsBuilder;
         } else {
            LoaderConfigurationBuilder tmpLoaderBuilder = builder.loaders().addCacheLoader();
            tmpLoaderBuilder.cacheLoader(Util.<CacheLoader>getInstance(clc.getCacheLoaderClassName(), legacy.getClassLoader()));
            if (clc instanceof CacheStoreConfig) {
               CacheStoreConfig csc = (CacheStoreConfig) clc;
               tmpLoaderBuilder.fetchPersistentState(csc.isFetchPersistentState());
               tmpLoaderBuilder.ignoreModifications(csc.isIgnoreModifications());
               tmpLoaderBuilder.purgeOnStartup(csc.isPurgeOnStartup());
               tmpLoaderBuilder.purgerThreads(csc.getPurgerThreads());
               tmpLoaderBuilder.purgeSynchronously(csc.isPurgeSynchronously());
               loaderBuilder = tmpLoaderBuilder;
            }
            if (clc instanceof AbstractCacheStoreConfig) {
               tmpLoaderBuilder.withProperties(((AbstractCacheLoaderConfig) clc).getProperties());
            }
         }
         if (clc instanceof CacheStoreConfig) {
            CacheStoreConfig csc = (CacheStoreConfig) clc;
            loaderBuilder.async().enabled(csc.getAsyncStoreConfig().isEnabled());
            loaderBuilder.async().flushLockTimeout(csc.getAsyncStoreConfig().getFlushLockTimeout());
            loaderBuilder.async().modificationQueueSize(csc.getAsyncStoreConfig().getModificationQueueSize());
            loaderBuilder.async().shutdownTimeout(csc.getAsyncStoreConfig().getShutdownTimeout());
            loaderBuilder.async().threadPoolSize(csc.getAsyncStoreConfig().getThreadPoolSize());
            loaderBuilder.singletonStore().enabled(csc.getSingletonStoreConfig().isSingletonStoreEnabled());
            loaderBuilder.singletonStore().pushStateTimeout(csc.getSingletonStoreConfig().getPushStateTimeout());
            loaderBuilder.singletonStore().pushStateWhenCoordinator(csc.getSingletonStoreConfig().isPushStateWhenCoordinator());
         }
      }
     
      builder.locking()
         .concurrencyLevel(legacy.getConcurrencyLevel())
View Full Code Here


                ModelNode store = cache.get(ModelKeys.STORE);
                FluentConfiguration.LoadersConfig fluentStores = fluent.loaders();
                fluentStores.shared(store.hasDefined(ModelKeys.SHARED) ? store.get(ModelKeys.SHARED).asBoolean() : false);
                fluentStores.preload(store.hasDefined(ModelKeys.PRELOAD) ? store.get(ModelKeys.PRELOAD).asBoolean() : false);
                fluentStores.passivation(store.hasDefined(ModelKeys.PASSIVATION) ? store.get(ModelKeys.PASSIVATION).asBoolean() : true);
                CacheStoreConfig storeConfig = buildCacheStore(name, builder, store);
                storeConfig.singletonStore().enabled(store.hasDefined(ModelKeys.SINGLETON) ? store.get(ModelKeys.SINGLETON).asBoolean() : false);
                storeConfig.fetchPersistentState(store.hasDefined(ModelKeys.FETCH_STATE) ? store.get(ModelKeys.FETCH_STATE).asBoolean() : true);
                storeConfig.purgeOnStartup(store.hasDefined(ModelKeys.PURGE) ? store.get(ModelKeys.PURGE).asBoolean() : true);
                if (store.hasDefined(ModelKeys.PROPERTY) && (storeConfig instanceof AbstractCacheStoreConfig)) {
                    Properties properties = new Properties();
                    for (Property property : store.get(ModelKeys.PROPERTY).asPropertyList()) {
                        properties.setProperty(property.getName(), property.getValue().asString());
                    }
View Full Code Here

   private final int EVICTION_MAX_ENTRIES = 2;

   private Configuration buildCfg(EvictionThreadPolicy threadPolicy, EvictionStrategy strategy) {
      Configuration cfg = new Configuration();
      CacheStoreConfig cacheStoreConfig = new DummyInMemoryCacheStore.Cfg();
      cacheStoreConfig.setPurgeOnStartup(true);
      cfg.getCacheLoaderManagerConfig().addCacheLoaderConfig(cacheStoreConfig);
      cfg.getCacheLoaderManagerConfig().setPassivation(true);
      cfg.setEvictionStrategy(strategy);
      cfg.setEvictionThreadPolicy(threadPolicy);
      cfg.setEvictionMaxEntries(EVICTION_MAX_ENTRIES);
View Full Code Here

   private static final long lifespan = 6000000;

   @Override
   protected CacheStore createCacheStore() throws CacheLoaderException {
      ChainingCacheStore store = new ChainingCacheStore();
      CacheStoreConfig cfg = new DummyInMemoryCacheStore.Cfg()
         .storeName("ChainingCacheLoaderTest_instance1")
         .purgeOnStartup(false)
         .fetchPersistentState(false);
      store1 = new DummyInMemoryCacheStore();
      store1.init(cfg, getCache(), new TestObjectStreamMarshaller());
View Full Code Here

      return TestCacheManagerFactory.createCacheManager(GlobalConfiguration.getNonClusteredDefault(), configuration);
   }

   private void enableTestJdbcStorage(Configuration configuration) throws Exception {
      CacheStoreConfig fileStoreConfiguration = createCacheStoreConfig();
      AsyncStoreConfig asyncStoreConfig = new AsyncStoreConfig();
      asyncStoreConfig.setEnabled(true);
      asyncStoreConfig.setThreadPoolSize(1);
      fileStoreConfiguration.setAsyncStoreConfig(asyncStoreConfig);
      CacheLoaderManagerConfig loaderManagerConfig = configuration.getCacheLoaderManagerConfig();
      loaderManagerConfig.setPassivation(false);
      loaderManagerConfig.setPreload(false);
      loaderManagerConfig.setShared(true);
      loaderManagerConfig.addCacheLoaderConfig(fileStoreConfiguration);
View Full Code Here

      Element propertiesElement = getSingleElementInCoreNS("properties", indivElement);
      Properties props = XmlConfigHelper.extractProperties(propertiesElement);
      if (props != null) XmlConfigHelper.setValues(clc, props, false, true);

      if (clc instanceof CacheStoreConfig) {
         CacheStoreConfig csc = (CacheStoreConfig) clc;
         String fetchPersistentState = getAttributeValue(indivElement, "fetchPersistentState");
         if (existsAttribute(fetchPersistentState)) csc.setFetchPersistentState(getBoolean(fetchPersistentState));
         String ignoreModifications = getAttributeValue(indivElement, "ignoreModifications");
         if (existsAttribute(ignoreModifications)) csc.setIgnoreModifications(getBoolean(ignoreModifications));
         String purgeOnStartup = getAttributeValue(indivElement, "purgeOnStartup");
         if (existsAttribute(purgeOnStartup)) csc.setPurgeOnStartup(getBoolean(purgeOnStartup));
         csc.setSingletonStoreConfig(parseSingletonStoreConfig(getSingleElementInCoreNS("singletonStore", indivElement)));
         csc.setAsyncStoreConfig(parseAsyncStoreConfig(getSingleElementInCoreNS("async", indivElement)));
      }
      return clc;
   }
View Full Code Here

            loaderBuilder = fcsBuilder;
         } else {
            LoaderConfigurationBuilder tmpLoaderBuilder = builder.loaders().addCacheLoader();
            tmpLoaderBuilder.cacheLoader(Util.<CacheLoader>getInstance(clc.getCacheLoaderClassName(), legacy.getClassLoader()));
            if (clc instanceof CacheStoreConfig) {
               CacheStoreConfig csc = (CacheStoreConfig) clc;
               tmpLoaderBuilder.fetchPersistentState(csc.isFetchPersistentState());
               tmpLoaderBuilder.ignoreModifications(csc.isIgnoreModifications());
               tmpLoaderBuilder.purgeOnStartup(csc.isPurgeOnStartup());
               tmpLoaderBuilder.purgerThreads(csc.getPurgerThreads());
               tmpLoaderBuilder.purgeSynchronously(csc.isPurgeSynchronously());
               loaderBuilder = tmpLoaderBuilder;
            }
            if (clc instanceof AbstractCacheStoreConfig) {
               tmpLoaderBuilder.withProperties(((AbstractCacheLoaderConfig) clc).getProperties());
            }
         }
         if (clc instanceof CacheStoreConfig) {
            CacheStoreConfig csc = (CacheStoreConfig) clc;
            loaderBuilder.async().enabled(csc.getAsyncStoreConfig().isEnabled());
            loaderBuilder.async().flushLockTimeout(csc.getAsyncStoreConfig().getFlushLockTimeout());
            loaderBuilder.async().modificationQueueSize(csc.getAsyncStoreConfig().getModificationQueueSize());
            loaderBuilder.async().shutdownTimeout(csc.getAsyncStoreConfig().getShutdownTimeout());
            loaderBuilder.async().threadPoolSize(csc.getAsyncStoreConfig().getThreadPoolSize());
            loaderBuilder.singletonStore().enabled(csc.getSingletonStoreConfig().isSingletonStoreEnabled());
            loaderBuilder.singletonStore().pushStateTimeout(csc.getSingletonStoreConfig().getPushStateTimeout());
            loaderBuilder.singletonStore().pushStateWhenCoordinator(csc.getSingletonStoreConfig().isPushStateWhenCoordinator());
         }
      }
     
      builder.locking()
         .concurrencyLevel(legacy.getConcurrencyLevel())
View Full Code Here

            }
            fcsc.fsyncInterval(store.fsyncInterval());
            fcsc.streamBufferSize(store.streamBufferSize());
         }
         if (clc instanceof CacheStoreConfig) {
            CacheStoreConfig csc = (CacheStoreConfig) clc;
            csc.fetchPersistentState(loader.fetchPersistentState());
            csc.ignoreModifications(loader.ignoreModifications());
            csc.purgeOnStartup(loader.purgeOnStartup())
            csc.setPurgeSynchronously(loader.purgeSynchronously());
            csc.getAsyncStoreConfig().setEnabled(loader.async().enabled());
            csc.getAsyncStoreConfig().flushLockTimeout(loader.async().flushLockTimeout());
            csc.getAsyncStoreConfig().modificationQueueSize(loader.async().modificationQueueSize());
            csc.getAsyncStoreConfig().shutdownTimeout(loader.async().shutdownTimeout());
            csc.getAsyncStoreConfig().threadPoolSize(loader.async().threadPoolSize());
           
            csc.getSingletonStoreConfig().enabled(loader.singletonStore().enabled());
            csc.getSingletonStoreConfig().pushStateTimeout(loader.singletonStore().pushStateTimeout());
            csc.getSingletonStoreConfig().pushStateWhenCoordinator(loader.singletonStore().pushStateWhenCoordinator());
         }
         if (clc instanceof AbstractCacheStoreConfig) {
            AbstractCacheStoreConfig acsc = (AbstractCacheStoreConfig) clc;
            Properties p = loader.properties();
            acsc.setProperties(p);
View Full Code Here

      boolean shared = cacheLoaderManagerConfig.isShared();
      if (!shared) {
         for (CacheLoaderConfig loaderConfig : cacheLoaderManagerConfig.getCacheLoaderConfigs()) {
            if (loaderConfig instanceof CacheStoreConfig) {
               CacheStoreConfig storeConfig = (CacheStoreConfig)loaderConfig;
               Boolean fetchPersistentState = storeConfig.isFetchPersistentState();
               Boolean purgeOnStartup = storeConfig.isPurgeOnStartup();
               if (!fetchPersistentState && !purgeOnStartup && cfg.getCacheMode().isClustered()) {
                  log.staleEntriesWithoutFetchPersistentStateOrPurgeOnStartup();
               }
            }
         }
View Full Code Here

   private boolean hasAsyncStore() {
      List<CacheLoaderConfig> loaderConfigs = configuration.getCacheLoaderManagerConfig().getCacheLoaderConfigs();
      for (CacheLoaderConfig loaderConfig : loaderConfigs) {
         if (loaderConfig instanceof CacheStoreConfig) {
            CacheStoreConfig storeConfig = (CacheStoreConfig) loaderConfig;
            if (storeConfig.getAsyncStoreConfig().isEnabled())
               return true;
         }
      }
      return false;
   }
View Full Code Here

TOP

Related Classes of org.infinispan.loaders.CacheStoreConfig

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.