Package org.infinispan.config

Examples of org.infinispan.config.Configuration$L1Config


      CacheCategory category = entry.getKey();
      InfinispanConfiguration config = entry.getValue();
      if (config.isCacheEnabled()) {
        String configurationName = config.getConfigurationName();
        if (null == configurationName) {
          Configuration infinispan;
          infinispan = manager.getDefaultConfiguration().clone();
          infinispan.applyOverrides(config.getInfinispanConfiguration());
          configurationName = "$" + category.getName() + "$" + cacheInfo.getId();
          manager.defineConfiguration(configurationName, infinispan);
        }
        recorder.record("infinispan", "configuration name " + configurationName);
        cacheService = new InfinispanCacheService(manager.<String, Object>getCache(configurationName));
View Full Code Here


  
   @Override
   public boolean isDistributed()
   {
      EmbeddedCacheManager container = (EmbeddedCacheManager) this.container;
      Configuration config = (this.cacheName != null) ? container.defineConfiguration(this.cacheName, new Configuration()) : container.getDefaultConfiguration();
      return config.getCacheMode().isDistributed();
   }
View Full Code Here

      GlobalConfiguration global = local ? GlobalConfiguration.getNonClusteredDefault() : GlobalConfiguration.getClusteredDefault();
      global.setClusterName("testing");
      global.setCacheManagerName("container" + containerIndex++);
      global.setStrictPeerToPeer(false);

      Configuration config = new Configuration();
      config.setInvocationBatchingEnabled(true);
      config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
      config.setSyncReplTimeout(20000);
      config.setLockAcquisitionTimeout(15000);
      config.setCacheMode(local ? CacheMode.LOCAL : (totalReplication ? CacheMode.REPL_SYNC : CacheMode.DIST_SYNC));
     
      CacheMode mode = config.getCacheMode();

      config.setFetchInMemoryState(mode.isReplicated());
     
      // Block for commits -- no races between test driver and replication
      config.setSyncCommitPhase(true);
      config.setSyncRollbackPhase(true);
     
      if (passivationDir != null)
      {
         CacheLoaderManagerConfig managerConfig = new CacheLoaderManagerConfig();
         managerConfig.setPassivation(true);
         managerConfig.setPreload(!purgeCacheLoader);
        
         FileCacheStoreConfig fileConfig = new FileCacheStoreConfig();
         fileConfig.setLocation(passivationDir);
         fileConfig.setFetchPersistentState(mode.isReplicated());
         fileConfig.setPurgeOnStartup(purgeCacheLoader);
        
         managerConfig.setCacheLoaderConfigs(Collections.<CacheLoaderConfig>singletonList(fileConfig));
        
         config.setCacheLoaderManagerConfig(managerConfig);
      }
     
      final EmbeddedCacheManager sessionContainer = new DefaultCacheManager(global, config, false);
     
      global = local ? GlobalConfiguration.getNonClusteredDefault() : GlobalConfiguration.getClusteredDefault();
      global.setClusterName("testing-jvmroute");
      global.setCacheManagerName("container" + containerIndex++);
      global.setStrictPeerToPeer(false);
     
      config = new Configuration();
      config.setInvocationBatchingEnabled(true);
      config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
      config.setSyncReplTimeout(20000);
      config.setLockAcquisitionTimeout(15000);
      config.setCacheMode(CacheMode.REPL_SYNC);
      config.setFetchInMemoryState(true);
      config.setSyncCommitPhase(true);
      config.setSyncRollbackPhase(true);
     
      final EmbeddedCacheManager jvmRouteContainer = new DefaultCacheManager(global, config, false);
     
      return new EmbeddedCacheManager()
      {
View Full Code Here

   private void defineGenericDataTypeCacheConfigurations(Settings settings, Properties properties) throws CacheException {
      String[] defaultGenericDataTypes = new String[]{ENTITY_KEY, COLLECTION_KEY, TIMESTAMPS_KEY, QUERY_KEY};
      for (String type : defaultGenericDataTypes) {
         TypeOverrides override = overrideStatisticsIfPresent(typeOverrides.get(type), properties);
         String cacheName = override.getCacheName();
         Configuration newCacheCfg = override.createInfinispanConfiguration();
         // Apply overrides
         Configuration cacheConfig = manager.defineConfiguration(cacheName, cacheName, newCacheCfg);
         // Configure transaction manager
         cacheConfig = configureTransactionManager(cacheConfig, cacheName, properties);
         manager.defineConfiguration(cacheName, cacheName, cacheConfig);
         definedConfigurations.add(cacheName);
         override.validateInfinispanConfiguration(cacheConfig);
View Full Code Here

   private AdvancedCache getCache(String regionName, String typeKey, Properties properties) {
      TypeOverrides regionOverride = typeOverrides.get(regionName);
      if (!definedConfigurations.contains(regionName)) {
         String templateCacheName = null;
         Configuration regionCacheCfg = null;
         if (regionOverride != null) {
            if (log.isDebugEnabled()) log.debug("Cache region specific configuration exists: " + regionOverride);
            regionOverride = overrideStatisticsIfPresent(regionOverride, properties);
            regionCacheCfg = regionOverride.createInfinispanConfiguration();
            String cacheName = regionOverride.getCacheName();
View Full Code Here

      return cache;
   }

   private Configuration configureTransactionManager(Configuration regionOverrides, String templateCacheName, Properties properties) {
      // Get existing configuration to verify whether a tm was configured or not.
      Configuration templateConfig = manager.defineConfiguration(templateCacheName, new Configuration());
      if (templateConfig.isTransactionalCache()) {
         String ispnTmLookupClassName = templateConfig.getTransactionManagerLookupClass();
         String hbTmLookupClassName = org.hibernate.cache.infinispan.tm.HibernateTransactionManagerLookup.class.getName();
         if (ispnTmLookupClassName != null && !ispnTmLookupClassName.equals(hbTmLookupClassName)) {
            log.debug("Infinispan is configured [" + ispnTmLookupClassName + "] with a different transaction manager lookup " +
                            "class than Hibernate [" + hbTmLookupClassName + "]");
         } else {
View Full Code Here

      assertInitialized();
      if (gc == null) {
         Element defaultElement = getSingleElementInCoreNS("default", rootElement);
         // there may not be a <default /> element!
         if (defaultElement == null) {
            return new Configuration();
         } else {
            defaultElement.normalize();
            return parseConfiguration(defaultElement);
         }
      } else {
View Full Code Here

   public GlobalConfiguration parseGlobalConfiguration() {
      assertInitialized();
      if (gc == null) {
         Element globalElement = getSingleElementInCoreNS("global", rootElement);
         Configuration defaultConfig = parseDefaultConfiguration();
         gc = new GlobalConfiguration();
         gc.setDefaultConfiguration(defaultConfig);
         // there may not be a <global /> element in the config!!
         if (globalElement != null) {
            globalElement.normalize();
View Full Code Here

      return gc;
   }

   private Configuration parseConfiguration(Element e) {
      Configuration c = new Configuration();
      configureLocking(getSingleElementInCoreNS("locking", e), c);
      configureTransaction(getSingleElementInCoreNS("transaction", e), c);
      configureCacheJmxStatistics(getSingleElementInCoreNS("jmxStatistics", e), c);
      configureLazyDeserialization(getSingleElementInCoreNS("lazyDeserialization", e), c);
      configureInvocationBatching(getSingleElementInCoreNS("invocationBatching", e), c);
View Full Code Here

    * @param defaultConfiguration default configuration to use.  If null, a default instance is created.
    * @param start                if true, the cache manager is started
    */
   public DefaultCacheManager(GlobalConfiguration globalConfiguration, Configuration defaultConfiguration, boolean start) {
      this.globalConfiguration = globalConfiguration == null ? new GlobalConfiguration() : globalConfiguration.clone();
      this.globalConfiguration.setDefaultConfiguration(defaultConfiguration == null ? new Configuration() : defaultConfiguration.clone());
      globalComponentRegistry = new GlobalComponentRegistry(this.globalConfiguration, this);
      if (start) start();
   }
View Full Code Here

TOP

Related Classes of org.infinispan.config.Configuration$L1Config

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.