Package org.infinispan.config

Examples of org.infinispan.config.Configuration$ClusteringType


         acquired = true;
         CacheWrapper existingCache = caches.get(cacheName);
         if (existingCache != null)
            return null;

         Configuration c = getConfiguration(cacheName);
         setConfigurationName(cacheName, c);

         c.setGlobalConfiguration(globalConfiguration);
         c.accept(configurationValidator);
         c.assertValid();
         Cache cache = new InternalCacheFactory().createCache(c, globalComponentRegistry, cacheName, reflectionCache);
         CacheWrapper cw = new CacheWrapper(cache);
         existingCache = caches.put(cacheName, cw);
         if (existingCache != null) {
            throw new IllegalStateException("attempt to initialize the cache twice");
View Full Code Here


            cacheCreateLock.unlock();
      }
   }

   private Configuration getConfiguration(String cacheName) {
      Configuration c;
      if (cacheName.equals(DEFAULT_CACHE_NAME) || !configurationOverrides.containsKey(cacheName))
         c = defaultConfiguration.clone();
      else
         c = configurationOverrides.get(cacheName);
      return c;
View Full Code Here

    private DefaultCacheManager cacheManager;
    private ContextTrackingService contextTracking;

    public DistributedMapPeristenceService() {
        GlobalConfiguration globalConf = GlobalConfiguration.getClusteredDefault();
        Configuration cfg = new Configuration();
        cfg.setCacheMode(Configuration.CacheMode.DIST_SYNC);
        cfg.setNumOwners(3);
        cacheManager = new DefaultCacheManager(globalConf, cfg);
        contextTracking = ContextTrackingProvider.getTrackingService();

    }
View Full Code Here

            if (log.isInfoEnabled()) log.namedCacheDoesNotExist(cacheName);
            return new ExceptionResponse(new NamedCacheNotFoundException(cacheName, "Cannot process command " + cmd + " on node " + transport.getAddress()));
         }
      }

      final Configuration localConfig = cr.getComponent(Configuration.class);
      cmd.injectComponents(localConfig, cr);

      // in distributed mode we need to allow rehash control commands to go through even if we're not started yet
      // in other modes we just wait until the cache is fully started
      if (!localConfig.getCacheMode().isDistributed()) {
         long giveupTime = System.currentTimeMillis() + localConfig.getStateRetrievalTimeout();
         while (cr.getStatus().startingUp() && System.currentTimeMillis() < giveupTime)
            LockSupport.parkNanos(MILLISECONDS.toNanos(100));
      }

      return handleWithRetry(cmd);
View Full Code Here

   public DefaultCacheManager(GlobalConfiguration globalConfiguration, Configuration defaultConfiguration,
                              boolean start) {
      this.globalConfiguration = globalConfiguration == null ? new GlobalConfiguration() : globalConfiguration
              .clone();
      this.globalConfiguration.accept(new ConfigurationValidatingVisitor());
      this.defaultConfiguration = defaultConfiguration == null ? new Configuration() : defaultConfiguration.clone();
      this.defaultConfiguration.accept(new ConfigurationValidatingVisitor());
      this.globalComponentRegistry = new GlobalComponentRegistry(this.globalConfiguration, this, reflectionCache);
      this.cacheNameLockContainer = new ReentrantPerEntryLockContainer(this.defaultConfiguration.getConcurrencyLevel());
      if (start)
         start();
View Full Code Here

                 new ConfigurationValidatingVisitor());

         globalConfiguration = configuration.parseGlobalConfiguration();
         defaultConfiguration = configuration.parseDefaultConfiguration();
         for (Map.Entry<String, Configuration> entry : configuration.parseNamedConfigurations().entrySet()) {
            Configuration c = defaultConfiguration.clone();
            c.applyOverrides(entry.getValue());
            configurationOverrides.put(entry.getKey(), c);
         }
         globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this, reflectionCache);
         cacheNameLockContainer = new ReentrantPerEntryLockContainer(defaultConfiguration.getConcurrencyLevel());
      } catch (RuntimeException re) {
View Full Code Here

                 configurationStream, InfinispanConfiguration.findSchemaInputStream(),
                 new ConfigurationValidatingVisitor());
         globalConfiguration = configuration.parseGlobalConfiguration();
         defaultConfiguration = configuration.parseDefaultConfiguration();
         for (Map.Entry<String, Configuration> entry : configuration.parseNamedConfigurations().entrySet()) {
            Configuration c = defaultConfiguration.clone();
            c.applyOverrides(entry.getValue());
            configurationOverrides.put(entry.getKey(), c);
         }
         globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this, reflectionCache);
         cacheNameLockContainer = new ReentrantPerEntryLockContainer(defaultConfiguration.getConcurrencyLevel());
      } catch (ConfigurationException ce) {
View Full Code Here

            InfinispanConfiguration NCconfiguration = InfinispanConfiguration.newInfinispanConfiguration(
                    namedCacheFile, InfinispanConfiguration.resolveSchemaPath(),
                    new ConfigurationValidatingVisitor());

            for (Map.Entry<String, Configuration> entry : NCconfiguration.parseNamedConfigurations().entrySet()) {
               Configuration c = defaultConfiguration.clone();
               c.applyOverrides(entry.getValue());
               configurationOverrides.put(entry.getKey(), c);
            }
         }

         globalComponentRegistry = new GlobalComponentRegistry(this.globalConfiguration, this, reflectionCache);
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public Configuration defineConfiguration(String cacheName, String templateName, Configuration configurationOverride) {
      if (templateName != null) {
         Configuration c = configurationOverrides.get(templateName);
         if (c != null)
            return defineConfiguration(cacheName, configurationOverride, c, false);
         return defineConfiguration(cacheName, configurationOverride);
      }
      return defineConfiguration(cacheName, configurationOverride);
View Full Code Here

      if (cacheName == null || configOverride == null)
         throw new NullPointerException("Null arguments not allowed");
      if (cacheName.equals(DEFAULT_CACHE_NAME))
         throw new IllegalArgumentException("Cache name cannot be used as it is a reserved, internal name");
      if (checkExisting) {
         Configuration existing = configurationOverrides.get(cacheName);
         if (existing != null) {
            existing.applyOverrides(configOverride);
            return existing.clone();
         }
      }
      Configuration configuration = defaultConfigIfNotPresent.clone();
      configuration.applyOverrides(configOverride.clone());
      configurationOverrides.put(cacheName, configuration);
      return configuration;
   }
View Full Code Here

TOP

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

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.