Package org.infinispan.config.Configuration

Examples of org.infinispan.config.Configuration.CacheMode


                    this.writeOptional(writer, Attribute.MACHINE, transport, ModelKeys.MACHINE);
                    writer.writeEndElement();
                }

                for (ModelNode cache: container.get(ModelKeys.CACHE).asList()) {
                    CacheMode mode = CacheMode.valueOf(cache.get(ModelKeys.MODE).asString());
                    if (mode.isClustered()) {
                        if (mode.isDistributed()) {
                            writer.writeStartElement(Element.DISTRIBUTED_CACHE.getLocalName());
                            this.writeOptional(writer, Attribute.OWNERS, cache, ModelKeys.OWNERS);
                            this.writeOptional(writer, Attribute.VIRTUAL_NODES, cache, ModelKeys.VIRTUAL_NODES);
                            this.writeOptional(writer, Attribute.L1_LIFESPAN, cache, ModelKeys.L1_LIFESPAN);
                        } else if (mode.isInvalidation()) {
                            writer.writeStartElement(Element.INVALIDATION_CACHE.getLocalName());
                        } else {
                            writer.writeStartElement(Element.REPLICATED_CACHE.getLocalName());
                        }
                        writer.writeAttribute(Attribute.MODE.getLocalName(), Mode.forCacheMode(mode).name());
View Full Code Here


      boolean isSkipLoader = isSkipLoader(flags);
      if (!isSkipLoader) {
         // if we can't skip the cacheloader, we really want a thread for async.
         return false;
      }
      CacheMode cacheMode = config.getCacheMode();
      if (!cacheMode.isDistributed()) {
         //in these cluster modes we won't RPC for a get, so no need to fork a thread.
         return true;
      } else if (flags != null && (flags.contains(Flag.SKIP_REMOTE_LOOKUP) || flags.contains(Flag.CACHE_MODE_LOCAL))) {
         //with these flags we won't RPC either
         return true;
View Full Code Here

   private Configuration applyOverrides(Configuration configuration, ReplicationConfig replConfig)
   {
      Integer backups = replConfig.getBackups();
      ReplicationMode replMode = replConfig.getReplicationMode();
     
      CacheMode mode = configuration.getCacheMode();
     
      if (backups != null)
      {
         int value = backups.intValue();
        
         configuration.setNumOwners(value);
        
         if (value == 0)
         {
            mode = CacheMode.LOCAL;
         }
         else
         {
            boolean dist = (value > 0);
            boolean synchronous = mode.isSynchronous();
            if (dist)
            {
               mode = synchronous ? CacheMode.DIST_SYNC : CacheMode.DIST_ASYNC;
            }
            else // Negative backups means total replication
            {
               mode = synchronous ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
            }
            configuration.setFetchInMemoryState(!dist);
         }
      }
     
      if (replMode != null)
      {
         switch (replMode)
         {
            case SYNCHRONOUS:
            {
               mode = mode.toSync();
               break;
            }
            case ASYNCHRONOUS:
            {
               mode = mode.toAsync();
               break;
            }
         }
      }
     
View Full Code Here

                    this.writeOptional(writer, Attribute.MACHINE, transport, ModelKeys.MACHINE);
                    writer.writeEndElement();
                }

                for (ModelNode cache: container.get(ModelKeys.CACHE).asList()) {
                    CacheMode mode = CacheMode.valueOf(cache.get(ModelKeys.MODE).asString());
                    if (mode.isClustered()) {
                        if (mode.isDistributed()) {
                            writer.writeStartElement(Element.DISTRIBUTED_CACHE.getLocalName());
                            this.writeOptional(writer, Attribute.OWNERS, cache, ModelKeys.OWNERS);
                            this.writeOptional(writer, Attribute.VIRTUAL_NODES, cache, ModelKeys.VIRTUAL_NODES);
                            this.writeOptional(writer, Attribute.L1_LIFESPAN, cache, ModelKeys.L1_LIFESPAN);
                        } else if (mode.isInvalidation()) {
                            writer.writeStartElement(Element.INVALIDATION_CACHE.getLocalName());
                        } else {
                            writer.writeStartElement(Element.REPLICATED_CACHE.getLocalName());
                        }
                        writer.writeAttribute(Attribute.MODE.getLocalName(), Mode.forCacheMode(mode).name());
View Full Code Here

      boolean isSkipLoader = isSkipLoader(flags);
      if (!isSkipLoader) {
         // if we can't skip the cacheloader, we really want a thread for async.
         return false;
      }
      CacheMode cacheMode = config.getCacheMode();
      if (!cacheMode.isDistributed()) {
         //in these cluster modes we won't RPC for a get, so no need to fork a thread.
         return true;
      } else if (flags != null && (flags.contains(Flag.SKIP_REMOTE_LOOKUP) || flags.contains(Flag.CACHE_MODE_LOCAL))) {
         //with these flags we won't RPC either
         return true;
View Full Code Here

   private void applyOverrides(Configuration configuration, ReplicationConfig replConfig)
   {
      Integer backups = replConfig.getBackups();
      ReplicationMode replMode = replConfig.getReplicationMode();
     
      CacheMode mode = configuration.getCacheMode();
     
      if (backups != null)
      {
         int value = backups.intValue();
        
         configuration.setNumOwners(value);
        
         if (value == 0)
         {
            mode = CacheMode.LOCAL;
         }
         else
         {
            boolean dist = (value > 0);
            boolean synchronous = mode.isSynchronous();
            if (dist)
            {
               mode = synchronous ? CacheMode.DIST_SYNC : CacheMode.DIST_ASYNC;
            }
            else // Negative backups means total replication
            {
               mode = synchronous ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
            }
            configuration.setFetchInMemoryState(!dist);
         }
      }
     
      if (replMode != null)
      {
         switch (replMode)
         {
            case SYNCHRONOUS:
            {
               mode = mode.toSync();
               break;
            }
            case ASYNCHRONOUS:
            {
               mode = mode.toAsync();
               break;
            }
         }
      }
     
View Full Code Here

      EmbeddedCacheManager container = this.registry.getCacheContainer(containerName);
      String cacheName = getCacheName(manager);
     
      Cache<?, ?> templateCache = container.getCache();
      Configuration configuration = templateCache.getConfiguration().clone();
      CacheMode mode = getCacheMode(replConfig, configuration);
      configuration.setCacheMode(mode);
      container.defineConfiguration(cacheName, configuration);
      return container.getCache(cacheName);
   }
View Full Code Here

   private CacheMode getCacheMode(ReplicationConfig replConfig, Configuration configuration)
   {
      Integer backups = replConfig.getBackups();
      ReplicationMode replMode = replConfig.getReplicationMode();
     
      CacheMode mode = configuration.getCacheMode();
     
      if (backups != null)
      {
         int value = backups.intValue();
        
         configuration.setNumOwners(value);
        
         if (value == 0)
         {
            mode = CacheMode.LOCAL;
         }
         else
         {
            boolean synchronous = mode.isSynchronous();
            if (value > 0)
            {
               mode = synchronous ? CacheMode.DIST_SYNC : CacheMode.DIST_ASYNC;
            }
            else // Negative backups means total replication
            {
               mode = synchronous ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
            }
         }
      }
     
      if (replMode != null)
      {
         switch (replMode)
         {
            case SYNCHRONOUS:
            {
               mode = mode.toSync();
               break;
            }
            case ASYNCHRONOUS:
            {
               mode = mode.toAsync();
               break;
            }
         }
      }
      return mode;
View Full Code Here

                    this.writeOptional(writer, Attribute.RACK, transport, ModelKeys.RACK);
                    this.writeOptional(writer, Attribute.MACHINE, transport, ModelKeys.MACHINE);
                }

                for (ModelNode cache: container.get(ModelKeys.CACHE).asList()) {
                    CacheMode mode = CacheMode.valueOf(cache.get(ModelKeys.MODE).asString());
                    if (mode.isClustered()) {
                        if (mode.isDistributed()) {
                            writer.writeStartElement(Element.DISTRIBUTED_CACHE.getLocalName());
                            this.writeOptional(writer, Attribute.OWNERS, cache, ModelKeys.OWNERS);
                            this.writeOptional(writer, Attribute.L1_LIFESPAN, cache, ModelKeys.L1_LIFESPAN);
                        } else if (mode.isInvalidation()) {
                            writer.writeStartElement(Element.INVALIDATION_CACHE.getLocalName());
                        } else {
                            writer.writeStartElement(Element.REPLICATED_CACHE.getLocalName());
                        }
                        writer.writeAttribute(Attribute.MODE.getLocalName(), Mode.forCacheMode(mode).name());
View Full Code Here

   private Configuration applyOverrides(Configuration configuration, ReplicationConfig replConfig)
   {
      Integer backups = replConfig.getBackups();
      ReplicationMode replMode = replConfig.getReplicationMode();
     
      CacheMode mode = configuration.getCacheMode();
     
      if (backups != null)
      {
         int value = backups.intValue();
        
         configuration.setNumOwners(value + 1);
        
         if (value == 0)
         {
            mode = CacheMode.LOCAL;
         }
         else
         {
            boolean dist = (value > 0);
            boolean synchronous = mode.isSynchronous();
            if (dist)
            {
               mode = synchronous ? CacheMode.DIST_SYNC : CacheMode.DIST_ASYNC;
            }
            else // Negative backups means total replication
            {
               mode = synchronous ? CacheMode.REPL_SYNC : CacheMode.REPL_ASYNC;
            }
            configuration.setFetchInMemoryState(!dist);
         }
      }
     
      if (replMode != null)
      {
         switch (replMode)
         {
            case SYNCHRONOUS:
            {
               mode = mode.toSync();
               break;
            }
            case ASYNCHRONOUS:
            {
               mode = mode.toAsync();
               break;
            }
         }
      }
     
View Full Code Here

TOP

Related Classes of org.infinispan.config.Configuration.CacheMode

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.