Examples of CacheMode


Examples of org.infinispan.config.Configuration.CacheMode

      {
         if (localMode)
         {
            if (allowLocalChanges == null)
            {
               CacheMode cacheMode = cache.getConfiguration().getCacheMode();
               if (cacheMode != CacheMode.DIST_ASYNC && cacheMode != CacheMode.DIST_SYNC)
               {
                  cache.withFlags(Flag.CACHE_MODE_LOCAL);
               }
            }
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

   @Override
   @SuppressWarnings("unchecked")
   public <T> T construct(Class<T> componentType) {
      Class<?> componentImpl;
      if (componentType.equals(ClusteringDependentLogic.class)) {
         CacheMode cacheMode = configuration.clustering().cacheMode();
         if (!cacheMode.isClustered()) {
            return componentType.cast(new ClusteringDependentLogic.LocalLogic());
         } else if (cacheMode.isInvalidation()) {
            return componentType.cast(new ClusteringDependentLogic.InvalidationLogic());
         } else if (cacheMode.isReplicated()) {
            return componentType.cast(new ClusteringDependentLogic.ReplicationLogic());
         } else {
            return componentType.cast(new ClusteringDependentLogic.DistributionLogic());
         }
      } else {
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

    * If no ConsistentHashFactory was explicitly configured we choose a suitable one based on cache mode.
    */
   private ConsistentHashFactory pickConsistentHashFactory() {
      ConsistentHashFactory factory = configuration.clustering().hash().consistentHashFactory();
      if (factory == null) {
         CacheMode cacheMode = configuration.clustering().cacheMode();
         if (cacheMode.isClustered()) {
            if (cacheMode.isDistributed()) {
               if (globalConfiguration.transport().hasTopologyInfo()) {
                  factory = new TopologyAwareConsistentHashFactory();
               } else {
                  factory = new DefaultConsistentHashFactory();
               }
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

   @Override
   @SuppressWarnings("unchecked")
   public <T> T construct(Class<T> componentType) {
      Class<?> componentImpl;
      if (componentType.equals(ClusteringDependentLogic.class)) {
         CacheMode cacheMode = configuration.clustering().cacheMode();
         if (cacheMode.isReplicated() || !cacheMode.isClustered() || cacheMode.isInvalidation()) {
            return componentType.cast(new ClusteringDependentLogic.AllNodesLogic());
         } else {
            return componentType.cast(new ClusteringDependentLogic.DistributionLogic());
         }
      } else {
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

    }
   
    private static volatile int containerIndex = 1;

    public static EmbeddedCacheManager createCacheContainer(boolean local, String passivationDir, boolean totalReplication, boolean purgeCacheLoader) throws Exception {
        CacheMode mode = local ? CacheMode.LOCAL : (totalReplication ? CacheMode.REPL_SYNC : CacheMode.DIST_SYNC);
        GlobalConfigurationBuilder globalBuilder = new GlobalConfigurationBuilder();
        String name = "container" + containerIndex++;
        globalBuilder.transport()
                .transport(local ? null : new JGroupsTransport())
                .addProperty(JGroupsTransport.CHANNEL_LOOKUP, ChannelLookup.class.getName())
                .distributedSyncTimeout(60000)
                .clusterName("test")
                .globalJmxStatistics().enable().cacheManagerName(name).allowDuplicateDomains(true)
        ;
        ConfigurationBuilder builder = new ConfigurationBuilder().read(CacheAdd.getDefaultConfiguration(mode));
        builder.transaction()
                .syncCommitPhase(true)
                .syncRollbackPhase(true)
                .transactionMode(TransactionMode.TRANSACTIONAL)
                .transactionManagerLookup(new TransactionManagerProvider(BatchModeTransactionManager.getInstance()))
                .invocationBatching().enable()
                .jmxStatistics().enable()
        ;
        if (passivationDir != null) {
            builder.loaders()
                    .passivation(true)
                    .preload(false)
//                    .preload(!purgeCacheLoader)
                    .addFileCacheStore()
                            .location(passivationDir)
                            .fsyncMode(FsyncMode.PER_WRITE)
                            .fetchPersistentState(mode.isReplicated())
                            .purgeOnStartup(purgeCacheLoader)
                            .purgeSynchronously(true)
            ;
        }
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

        if (tsr != null) {
            this.builder.transaction().transactionSynchronizationRegistryLookup(new TransactionSynchronizationRegistryProvider(tsr));
        }
        this.config = this.builder.build();

        CacheMode mode = this.config.clustering().cacheMode();
        if (mode.isClustered() && (container.getTransport() == null)) {
            throw InfinispanMessages.MESSAGES.transportRequired(mode, this.name, container.getCacheManagerConfiguration().globalJmxStatistics().cacheManagerName());
        }

        container.defineConfiguration(this.name, this.config);
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

                    caches.add(cacheEntry.getValue());
                }

                // for (ModelNode cache: container.get(ModelKeys.CACHE).asList()) {
                for (ModelNode cache: caches) {
                    CacheMode mode = CacheMode.valueOf(cache.get(ModelKeys.MODE).asString());
                    if (mode.isClustered()) {
                        if (mode.isDistributed()) {
                            writer.writeStartElement(Element.DISTRIBUTED_CACHE.getLocalName());
                            // write identifier before other attributes
                            this.writeRequired(writer, Attribute.NAME, cache, ModelKeys.NAME);
                            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());
                            // write identifier before other attributes
                            this.writeRequired(writer, Attribute.NAME, cache, ModelKeys.NAME);
                        } else {
                            writer.writeStartElement(Element.REPLICATED_CACHE.getLocalName());
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

        final boolean batching = CommonAttributes.BATCHING.resolveModelAttribute(context, cache).asBoolean();
        final boolean asyncMarshalling = CommonAttributes.ASYNC_MARSHALLING.resolveModelAttribute(context, cache).asBoolean();

        builder.classLoader(this.getClass().getClassLoader());
        // set the cache mode
        CacheMode cacheMode = CacheMode.valueOf(cache.require(ModelKeys.MODE).asString());
        builder.clustering().cacheMode(cacheMode);

        builder.indexing()
                .enabled(indexing.isEnabled())
                .indexLocalOnly(indexing.isLocalOnly())
        ;
        if (cacheMode.isSynchronous()) {
            builder.clustering().sync().replTimeout(remoteTimeout);
        } else  {
            builder.clustering().async()
                    .replQueueMaxElements(queueSize)
                    .useReplQueue(queueSize > 0)
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

            if (attributeDefinition != null) {
                final ModelNode syntheticOp = new ModelNode();
                syntheticOp.get(attributeName).set(newValue);
                attributeDefinition.validateOperation(syntheticOp);
            }
            CacheMode mode = getCacheMode(operation) ;
            submodel.get(ModelKeys.MODE).set(Mode.valueOf(newValue.asString()).apply(mode).name());
        }
        else {
            attributeDefinition = getAttributeDefinition(attributeName);
            if (attributeDefinition != null) {
View Full Code Here

Examples of org.infinispan.configuration.cache.CacheMode

    public static CacheMode getCacheMode(ModelNode operation) {

        PathAddress cacheAddress = PathAddress.pathAddress(operation.get(OP_ADDR));
        String cacheType = cacheAddress.getLastElement().getKey();

        CacheMode mode = null;
        if (cacheType.equals(ModelKeys.LOCAL_CACHE)) {
            mode = CacheMode.LOCAL;
        } else if (cacheType.equals(ModelKeys.INVALIDATION_CACHE)) {
            mode = CacheMode.INVALIDATION_SYNC;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.