Package org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig

Examples of org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig


      // initialize IndexerCacheLoader
      IndexerCacheLoader indexerCacheLoader = new IndexerCacheLoader();
      // inject dependencies
      indexerCacheLoader.init(searchManager, parentSearchManager, handler, parentHandler);
      // set SingltonStoreCacheLoader
      SingletonStoreConfig singletonStoreConfig = new SingletonStoreConfig();
      singletonStoreConfig.setSingletonStoreClass(IndexerSingletonStoreCacheLoader.class.getName());
      //singletonStoreConfig.setSingletonStoreClass(SingletonStoreCacheLoader.class.getName());
      Properties singletonStoreProperties = new Properties();

      // try to get pushState parameters, since they are set programmatically only
      Boolean pushState = config.getParameterBoolean(QueryHandlerParams.PARAM_JBOSSCACHE_PUSHSTATE, false);
      Integer pushStateTimeOut =
         config.getParameterInteger(QueryHandlerParams.PARAM_JBOSSCACHE_PUSHSTATE_TIMEOUT, 10000);

      singletonStoreProperties.setProperty("pushStateWhenCoordinator", pushState.toString());
      singletonStoreProperties.setProperty("pushStateWhenCoordinatorTimeout", pushStateTimeOut.toString());
      singletonStoreConfig.setProperties(singletonStoreProperties);
      singletonStoreConfig.setSingletonStoreEnabled(true);
      // create CacheLoaderConfig
      IndividualCacheLoaderConfig individualCacheLoaderConfig = new IndividualCacheLoaderConfig();
      // set SingletonStoreConfig
      individualCacheLoaderConfig.setSingletonStoreConfig(singletonStoreConfig);
      // set CacheLoader
View Full Code Here


   @Override  
   public void setConfig(CacheLoaderConfig.IndividualCacheLoaderConfig config)
   {
      super.setConfig(config);

      SingletonStoreConfig ssc = config.getSingletonStoreConfig();
      if (ssc instanceof SingletonStoreDefaultConfig)
      {
         this.config = (SingletonStoreDefaultConfig)ssc;
      }
      else if (ssc != null)
View Full Code Here

            }
            if (numLoadersWithFetchPersistentState > 1)
            {
               throw new Exception("Invalid cache loader configuration!!  Only ONE cache loader may have fetchPersistentState set to true.  Cache will not start!");
            }
            SingletonStoreConfig ssc = cfg.getSingletonStoreConfig();
            if (ssc != null && ssc.isSingletonStoreEnabled() && config.isShared())
            {
               throw new Exception("Invalid cache loader configuration!!  If a cache loader is configured as a singleton, the cache loader cannot be shared in a cluster!");
            }

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

            readOnlyDecorator = new ReadOnlyDelegatingCacheLoader(tmpLoader);
            tmpLoader = readOnlyDecorator;
         }

         // singleton?
         SingletonStoreConfig ssc = cfg.getSingletonStoreConfig();
         if (ssc != null && ssc.isSingletonStoreEnabled())
         {
            Object decorator = createInstance(ssc.getSingletonStoreClass());

            /* class providing singleton store functionality must extend AbstractDelegatingCacheLoader so that
            * underlying cacheloader can be set. */
            if (decorator instanceof AbstractDelegatingCacheLoader)
            {
View Full Code Here

            catch (IOException e)
            {
               throw new ConfigurationException("Problem loader cache loader properties", e);
            }

            SingletonStoreConfig ssc = parseSingletonStoreConfig(indivElement);
            if (ssc != null)
            {
               iclc.setSingletonStoreConfig(ssc);
            }
View Full Code Here

         }
         catch (IOException e)
         {
            throw new ConfigurationException("Problem loading singleton store properties", e);
         }
         SingletonStoreConfig ssc = new SingletonStoreConfig();
         ssc.setSingletonStoreEnabled(singletonStoreEnabled);
         ssc.setSingletonStoreClass(singletonStoreClass);
         ssc.setSingletonStoreproperties(singletonStoreproperties);

         return ssc;
      }

      return null;
View Full Code Here

      Cache<Serializable, Object> initCache = factory.createCache(config);

      // initialize IndexerCacheLoader
      IndexerCacheLoader indexerCacheLoader = new IndexerCacheLoader();
      // set SingltonStoreCacheLoader
      SingletonStoreConfig singletonStoreConfig = new SingletonStoreConfig();
      singletonStoreConfig.setSingletonStoreClass(IndexerSingletonStoreCacheLoader.class.getName());
      //singletonStoreConfig.setSingletonStoreClass(SingletonStoreCacheLoader.class.getName());
      Properties singletonStoreProperties = new Properties();

      // try to get pushState parameters, since they are set programmatically only
      Boolean pushState = config.getParameterBoolean(PARAM_JBOSSCACHE_PUSHSTATE, false);
      Long pushStateTimeOut = config.getParameterTime(PARAM_JBOSSCACHE_PUSHSTATE_TIMEOUT, 10000L);

      singletonStoreProperties.setProperty("pushStateWhenCoordinator", pushState.toString());
      singletonStoreProperties.setProperty("pushStateWhenCoordinatorTimeout", pushStateTimeOut.toString());
      singletonStoreConfig.setProperties(singletonStoreProperties);
      singletonStoreConfig.setSingletonStoreEnabled(true);
      // create CacheLoaderConfig
      IndividualCacheLoaderConfig individualCacheLoaderConfig = new IndividualCacheLoaderConfig();
      // set SingletonStoreConfig
      individualCacheLoaderConfig.setSingletonStoreConfig(singletonStoreConfig);
      // set CacheLoader
View Full Code Here

      Properties p1 = clc1.getProperties();     
      Properties p2 = clc2.getProperties();
      assertFalse(p1 == p2);
      assertEquals(p1, p2);
     
      SingletonStoreConfig ssc1 = clc1.getSingletonStoreConfig();     
      SingletonStoreConfig ssc2 = clc2.getSingletonStoreConfig();
      assertFalse(ssc1 == ssc2);
      assertEquals(ssc1, ssc2);
   }
View Full Code Here

      return tmpLoader;
   }

   private void assertNotSingletonAndShared(IndividualCacheLoaderConfig cfg)
   {
      SingletonStoreConfig ssc = cfg.getSingletonStoreConfig();
      if (ssc != null && ssc.isSingletonStoreEnabled() && config.isShared())
         throw new ConfigurationException("Invalid cache loader configuration!!  If a cache loader is configured as a singleton, the cache loader cannot be shared in a cluster!");
   }
View Full Code Here

            readOnlyDecorator = new ReadOnlyDelegatingCacheLoader(tmpLoader);
            tmpLoader = readOnlyDecorator;
         }

         // singleton?
         SingletonStoreConfig ssc = cfg.getSingletonStoreConfig();
         if (ssc != null && ssc.isSingletonStoreEnabled())
         {
            Object decorator = createInstance(ssc.getSingletonStoreClass());

            /* class providing singleton store functionality must extend AbstractDelegatingCacheLoader so that
            * underlying cacheloader can be set. */
            if (decorator instanceof AbstractDelegatingCacheLoader)
            {
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig

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.