Package org.infinispan.config

Examples of org.infinispan.config.Configuration$TransactionType


      cmd.injectComponents(null, globalComponentRegistry.getNamedComponentRegistry(cacheName));
      cmd.setCacheName(cacheName);
      Transport transport = getTransport();
      try {
         if (transport != null) {
            Configuration c = getConfiguration(cacheName);
            // Use sync replication timeout
            transport.invokeRemotely(null, cmd, ResponseMode.SYNCHRONOUS, c.getSyncReplTimeout(), false, null, false);
         }
         // Once sent to the cluster, remove the local cache
         cmd.perform(null);
      } catch (Throwable t) {
         throw new CacheException("Error removing cache", t);
View Full Code Here


   private Cache createCache(String cacheName) {
      CacheWrapper existingCache = caches.get(cacheName);
      if (existingCache != null)
         return existingCache.getCache();

      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);
      try {
         existingCache = caches.putIfAbsent(cacheName, cw);
         if (existingCache != null) {
View Full Code Here

      }
      return cache;
   }

   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

    */
   @Start(priority = 14)
   public void registerToMBeanServer() {
      if (cache == null)
         throw new IllegalStateException("The cache should had been injected before a call to this method");
      Configuration config = cache.getConfiguration();
      if (config.isExposeJmxStatistics()) {
         ComponentsJmxRegistration registrator = buildRegistrator();
         registrator.registerMBeans();
         log.info("MBeans were successfully registered to the platform mbean server.");
      }
   }
View Full Code Here

   @Stop
   public void unregisterMBeans() {
      //this method might get called several times.
      // After the first call the cache will become null, so we guard this
      if (cache == null) return;
      Configuration config = cache.getConfiguration();
      if (config.isExposeJmxStatistics()) {
         ComponentsJmxRegistration componentsJmxRegistration = buildRegistrator();
         componentsJmxRegistration.unregisterMBeans();
         log.trace("MBeans were successfully unregistered from the mbean server.");
      }
      cache = null;
View Full Code Here

      if (cr == null) {
         if (log.isInfoEnabled()) log.info("Cache named {0} does not exist on this cache manager!", cacheName);
         return new ExceptionResponse(new NamedCacheNotFoundException(cacheName));
      }

      Configuration localConfig = cr.getComponent(Configuration.class);

      if (!cr.getStatus().allowInvocations()) {
         giveupTime = System.currentTimeMillis() + localConfig.getStateRetrievalTimeout();
         while (cr.getStatus().startingUp() && System.currentTimeMillis() < giveupTime) Thread.sleep(100);
         if (!cr.getStatus().allowInvocations()) {
            log.warn("Cache named [{0}] exists but isn't in a state to handle invocations.  Its state is {1}.", cacheName, cr.getStatus());
            return RequestIgnoredResponse.INSTANCE;
         }
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

   }

   private void initialize(XmlConfigurationParser initializedParser) {
      globalConfiguration = initializedParser.parseGlobalConfiguration();
      for (Map.Entry<String, Configuration> entry : initializedParser.parseNamedConfigurations().entrySet()) {
         Configuration c = globalConfiguration.getDefaultConfiguration().clone();
         c.applyOverrides(entry.getValue());
         configurationOverrides.put(entry.getKey(), c);

      }
      globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this);
   }
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$TransactionType

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.