Package org.infinispan.config

Examples of org.infinispan.config.FluentConfiguration$LazyDeserializationConfig


        // process cache attributes and elements
        super.processModelNode(cache, configuration, additionalDeps);

        // process clustered cache attributes and elements
        FluentConfiguration fluent = configuration.fluent();
        if (cache.hasDefined(ModelKeys.QUEUE_SIZE)) {
            fluent.async().replQueueMaxElements(cache.get(ModelKeys.QUEUE_SIZE).asInt());
        }
        if (cache.hasDefined(ModelKeys.QUEUE_FLUSH_INTERVAL)) {
            fluent.async().replQueueInterval(cache.get(ModelKeys.QUEUE_FLUSH_INTERVAL).asLong());
        }
        // TODO  - need to check cache mode before setting
        if (cache.hasDefined(ModelKeys.REMOTE_TIMEOUT)) {
            // fluent.sync().replTimeout(cache.get(ModelKeys.REMOTE_TIMEOUT).asLong());
        }
View Full Code Here


        FluentGlobalConfiguration.GlobalJmxStatisticsConfig globalJmx = fluentTransport.globalJmxStatistics();
        globalJmx.cacheManagerName(this.configuration.getName());

        // setup default cache configuration
        Configuration defaultConfig = new Configuration();
        FluentConfiguration fluent = defaultConfig.fluent();

        MBeanServer server = this.configuration.getMBeanServer();
        if (server != null) {
            globalJmx.mBeanServerLookup(new MBeanServerProvider(server)).jmxDomain(SERVICE_NAME.getCanonicalName());
            fluent.jmxStatistics();
        } else {
            globalJmx.disable();
        }

        this.configureTransactions(defaultConfig);
View Full Code Here

    void processModelNode(ModelNode cache, Configuration configuration, List<AdditionalDependency<?>> additionalDeps) {
        // process the basic clustered configuration
        super.processModelNode(cache, configuration, additionalDeps);

        // process the additional distributed attributes and elements
        FluentConfiguration fluent = configuration.fluent();
        if (cache.hasDefined(ModelKeys.OWNERS)) {
            fluent.hash().numOwners(cache.get(ModelKeys.OWNERS).asInt());
        }
        if (cache.hasDefined(ModelKeys.VIRTUAL_NODES)) {
            fluent.hash().numVirtualNodes(cache.get(ModelKeys.VIRTUAL_NODES).asInt());
        }
        if (cache.hasDefined(ModelKeys.L1_LIFESPAN)) {
            long lifespan = cache.get(ModelKeys.L1_LIFESPAN).asLong();
            if (lifespan > 0) {
                fluent.l1().lifespan(lifespan);
            } else {
                fluent.l1().disable();
            }
        }

        // rehashing is a child resource
        if (cache.hasDefined(ModelKeys.SINGLETON) && cache.get(ModelKeys.SINGLETON, ModelKeys.REHASHING).isDefined()) {
            ModelNode rehashing = cache.get(ModelKeys.SINGLETON, ModelKeys.REHASHING);

            FluentConfiguration.HashConfig fluentHash = fluent.hash();
            if (rehashing.hasDefined(ModelKeys.ENABLED)) {
                fluentHash.rehashEnabled(rehashing.get(ModelKeys.ENABLED).asBoolean());
            }
            if (rehashing.hasDefined(ModelKeys.TIMEOUT)) {
                fluentHash.rehashRpcTimeout(rehashing.get(ModelKeys.TIMEOUT).asLong());
View Full Code Here

         }
         if (indexing != null) {
            dolly.indexing = indexing.clone();
            dolly.indexing.setConfiguration(dolly);
         }
         dolly.fluentConfig = new FluentConfiguration(dolly);
         return dolly;
      } catch (CloneNotSupportedException e) {
         throw new CacheException("Unexpected!", e);
      }
   }
View Full Code Here

     
      // Handle the case that null is passed in
      if (config == null)
         return null;
     
      FluentConfiguration legacy = new Configuration().fluent();
     
      legacy.clustering()
         .mode(CacheMode.valueOf(config.clustering().cacheMode().name()));
     
      if (!config.clustering().cacheMode().isSynchronous()) {
         legacy.clustering()
            .async()
               .asyncMarshalling(config.clustering().async().asyncMarshalling())
               .replQueueClass(config.clustering().async().replQueue().getClass())
               .replQueueInterval(config.clustering().async().replQueueInterval())
               .replQueueMaxElements(config.clustering().async().replQueueMaxElements());
      }
     
      if (config.clustering().hash().consistentHash() != null) {
         legacy.clustering()
            .hash()
               .consistentHashClass(config.clustering().hash().consistentHash().getClass());
     
      }
      if (config.clustering().hash().hash() != null) {
         legacy.clustering()
            .hash()
               .hashFunctionClass(config.clustering().hash().hash().getClass());
      }
      legacy.clustering()
      .hash()
            .numOwners(config.clustering().hash().numOwners())
            .numVirtualNodes(config.clustering().hash().numVirtualNodes())
            .rehashEnabled(config.clustering().hash().isRehashEnabled())
            .rehashRpcTimeout(config.clustering().hash().rehashRpcTimeout())
            .rehashWait(config.clustering().hash().rehashWait())
            .groups()
               .enabled(config.clustering().hash().groupsConfiguration().enabled())
               .groupers(config.clustering().hash().groupsConfiguration().groupers());
     
      if (config.clustering().l1().isEnabled()) {
         legacy.clustering()
            .l1()
               .invalidationThreshold(config.clustering().l1().invalidationThreshold())
               .lifespan(config.clustering().l1().lifespan())
               .onRehash(config.clustering().l1().onRehash());
      } else {
         legacy.clustering()
            .l1()
               .disable();
      }
     
      legacy.clustering()
         .stateRetrieval()
            .alwaysProvideInMemoryState(config.clustering().stateRetrieval().alwaysProvideInMemoryState())
            .fetchInMemoryState(config.clustering().stateRetrieval().fetchInMemoryState())
            .initialRetryWaitTime(config.clustering().stateRetrieval().initialRetryWaitTime())
            .logFlushTimeout(config.clustering().stateRetrieval().logFlushTimeout())
            .maxNonProgressingLogWrites(config.clustering().stateRetrieval().maxNonPorgressingLogWrites())
            .numRetries(config.clustering().stateRetrieval().numRetries())
            .retryWaitTimeIncreaseFactor(config.clustering().stateRetrieval().retryWaitTimeIncreaseFactor())
            .timeout(config.clustering().stateRetrieval().timeout());
     
      if (config.clustering().cacheMode().isSynchronous()) {
         legacy.clustering()
            .sync()
               .replTimeout(config.clustering().sync().replTimeout());
      }
     
      for (CommandInterceptor interceptor : config.customInterceptors().interceptors()) {
         legacy.clustering()
         .customInterceptors()
            .add(interceptor);
      }
     
      legacy.dataContainer()
         .dataContainer(config.dataContainer().dataContainer())
         .withProperties(config.dataContainer().properties());
     
      if (config.deadlockDetection().enabled()) {
         legacy.deadlockDetection()
            .spinDuration(config.deadlockDetection().spinDuration());
      } else {
         legacy.deadlockDetection()
            .disable();
      }
     
      legacy.eviction()
         .maxEntries(config.eviction().maxEntries())
         .strategy(config.eviction().strategy())
         .threadPolicy(config.eviction().threadPolicy());
     
      legacy.expiration()
         .lifespan(config.expiration().lifespan())
         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());
        
      if (config.indexing().enabled())
         legacy.indexing()
            .indexLocalOnly(config.indexing().indexLocalOnly());
      else
         legacy.indexing()
            .disable();
        
      if (config.invocationBatching().enabled())
         legacy.invocationBatching();

      if (config.jmxStatistics().enabled())
         legacy.jmxStatistics();
     
      // TODO lazy deserialization?
     
      legacy.loaders()
         .passivation(config.loaders().passivation())
         .preload(config.loaders().preload())
         .shared(config.loaders().shared());

      for (LoaderConfiguration loader : config.loaders().cacheLoaders()) {
         AbstractCacheStoreConfig csc = new AbstractCacheStoreConfig();
         csc.setCacheLoaderClassName(loader.cacheLoader().getClass().getName());
         csc.fetchPersistentState(loader.fetchPersistentState());
         csc.ignoreModifications(loader.ignoreModifications());
         csc.purgeOnStartup(loader.purgeOnStartup());
         csc.purgerThreads(loader.purgerThreads());
         csc.setPurgeSynchronously(loader.purgeSynchronously());
         csc.getAsyncStoreConfig().setEnabled(loader.async().enabled());
         csc.getAsyncStoreConfig().flushLockTimeout(loader.async().flushLockTimeout());
         csc.getAsyncStoreConfig().modificationQueueSize(loader.async().modificationQueueSize());
         csc.getAsyncStoreConfig().shutdownTimeout(loader.async().shutdownTimeout());
         csc.getAsyncStoreConfig().threadPoolSize(loader.async().threadPoolSize());
         csc.setProperties(loader.properties());
         csc.getSingletonStoreConfig().enabled(loader.singletonStore().enabled());
         csc.getSingletonStoreConfig().pushStateTimeout(loader.singletonStore().pushStateTimeout());
         csc.getSingletonStoreConfig().pushStateWhenCoordinator(loader.singletonStore().pushStateWhenCoordinator());
         legacy.loaders().addCacheLoader(csc);
      }
     
      legacy.locking()
         .concurrencyLevel(config.locking().concurrencyLevel())
         .isolationLevel(config.locking().isolationLevel())
         .lockAcquisitionTimeout(config.locking().lockAcquisitionTimeout())
         .useLockStriping(config.locking().useLockStriping())
         .writeSkewCheck(config.locking().writeSkewCheck());
     
      if (config.storeAsBinary().enabled())
         legacy.storeAsBinary()
            .storeKeysAsBinary(config.storeAsBinary().storeKeysAsBinary())
            .storeValuesAsBinary(config.storeAsBinary().storeValuesAsBinary());
      else
         legacy.storeAsBinary()
            .disable();
  
      legacy.transaction()
         .autoCommit(config.transaction().autoCommit())
         .cacheStopTimeout((int) config.transaction().cacheStopTimeout())
         .eagerLockSingleNode(config.transaction().eagerLockingSingleNode())
         .lockingMode(config.transaction().lockingMode())
         .syncCommitPhase(config.transaction().syncCommitPhase())
         .syncRollbackPhase(config.transaction().syncRollbackPhase())
         .transactionManagerLookup(config.transaction().transactionManagerLookup())
         .transactionMode(config.transaction().transactionMode())
         .useEagerLocking(config.transaction().useEagerLocking())
         .useSynchronization(config.transaction().useSynchronization());
     
      if (config.transaction().recovery().enabled()) {
         legacy.transaction().recovery();
      }
       
      legacy.unsafe().unreliableReturnValues(config.unsafe().unreliableReturnValues());

      if (config.versioningConfiguration().enabled()) {
         legacy.versioning()
               .enable()
               .versioningScheme(config.versioningConfiguration().scheme());
      }
     
      return legacy.build();
   }
View Full Code Here

         }
         if (indexing != null) {
            dolly.indexing = indexing.clone();
            dolly.indexing.setConfiguration(dolly);
         }
         dolly.fluentConfig = new FluentConfiguration(dolly);
         return dolly;
      } catch (CloneNotSupportedException e) {
         throw new CacheException("Unexpected!", e);
      }
   }
View Full Code Here

         }
         if (indexing != null) {
            dolly.indexing = indexing.clone();
            dolly.indexing.setConfiguration(dolly);
         }
         dolly.fluentConfig = new FluentConfiguration(dolly);
         return dolly;
      } catch (CloneNotSupportedException e) {
         throw new CacheException("Unexpected!", e);
      }
   }
View Full Code Here

     
      // Handle the case that null is passed in
      if (config == null)
         return null;
     
      FluentConfiguration legacy = new Configuration().fluent();
     
      legacy.clustering()
         .mode(CacheMode.valueOf(config.clustering().cacheMode().name()));
     
      if (!config.clustering().cacheMode().isSynchronous()) {
         legacy.clustering()
            .async()
               .asyncMarshalling(config.clustering().async().asyncMarshalling())
               .replQueueClass(config.clustering().async().replQueue().getClass())
               .replQueueInterval(config.clustering().async().replQueueInterval())
               .replQueueMaxElements(config.clustering().async().replQueueMaxElements())
               .useReplQueue(config.clustering().async().useReplQueue());
      }
     
      if (config.clustering().hash().consistentHash() != null) {
         legacy.clustering()
            .hash()
               .consistentHashClass(config.clustering().hash().consistentHash().getClass());
     
      }
      if (config.clustering().hash().activated) {
         if (config.clustering().hash().hash() != null) {
            legacy.clustering()
               .hash()
                  .hashFunctionClass(config.clustering().hash().hash().getClass());
         }

         legacy.clustering()
            .hash()
               .numOwners(config.clustering().hash().numOwners())
               .numVirtualNodes(config.clustering().hash().numVirtualNodes())
               .groups()
                  .enabled(config.clustering().hash().groups().enabled())
                  .groupers(config.clustering().hash().groups().groupers());
      }

      if (config.clustering().cacheMode().isDistributed()) {
         legacy.clustering()
               .hash()
               .rehashEnabled(config.clustering().stateTransfer().fetchInMemoryState())
               .rehashRpcTimeout(config.clustering().stateTransfer().timeout())
               .rehashWait(config.clustering().stateTransfer().timeout());
      } else if (config.clustering().cacheMode().isClustered()) { // REPL or DIST
         legacy.clustering()
               .stateRetrieval()
               .fetchInMemoryState(config.clustering().stateTransfer().fetchInMemoryState())
               .timeout(config.clustering().stateTransfer().timeout());
      }
      if (config.clustering().l1().activated && config.clustering().l1().enabled()) {
         legacy.clustering()
            .l1()
               .invalidationThreshold(config.clustering().l1().invalidationThreshold())
               .lifespan(config.clustering().l1().lifespan())
               .onRehash(config.clustering().l1().onRehash())
               .cleanupTaskFrequency(config.clustering().l1().cleanupTaskFrequency());
      } else {
         legacy.clustering()
            .l1()
               .disable()
               .onRehash(false);
      }

      // We have only defined the chunkSize in the legacy stateRetrieval config, but we are using it in distributed mode as well
      legacy.clustering()
         .stateRetrieval()
            .chunkSize(config.clustering().stateTransfer().chunkSize());
     
      if (config.clustering().cacheMode().isSynchronous()) {
         legacy.clustering()
            .sync()
               .replTimeout(config.clustering().sync().replTimeout());
      }
     
      for (InterceptorConfiguration interceptor : config.customInterceptors().interceptors()) {
         CustomInterceptorPosition position = legacy.customInterceptors()
            .add(interceptor.interceptor());
         if (interceptor.after() != null)
            position.after(interceptor.after());
         if (interceptor.index() > -1)
         position.atIndex(interceptor.index());
         if (interceptor.before() != null)
            position.before(interceptor.before());
         if (interceptor.first())
            position.first();
         if (interceptor.last())
            position.last();
      }
     
      legacy.dataContainer()
         .dataContainer(config.dataContainer().dataContainer())
         .withProperties(config.dataContainer().properties());
     
      if (config.deadlockDetection().enabled()) {
         legacy.deadlockDetection()
            .spinDuration(config.deadlockDetection().spinDuration());
      } else {
         legacy.deadlockDetection()
            .disable();
      }
     
      legacy.eviction()
         .maxEntries(config.eviction().maxEntries())
         .strategy(config.eviction().strategy())
         .threadPolicy(config.eviction().threadPolicy());
     
      legacy.expiration()
         .lifespan(config.expiration().lifespan())
         .maxIdle(config.expiration().maxIdle())
         .reaperEnabled(config.expiration().reaperEnabled())
         .wakeUpInterval(config.expiration().wakeUpInterval());
        
      if (config.indexing().enabled()) {
         IndexingConfig indexing = legacy.indexing();
         indexing.indexLocalOnly(config.indexing().indexLocalOnly());
         indexing.withProperties(config.indexing().properties());
      }
      else
         legacy.indexing()
            .disable();
        
      if (config.invocationBatching().enabled())
         legacy.invocationBatching();
      else
         legacy.invocationBatching().disable();

      if (config.jmxStatistics().enabled())
         legacy.jmxStatistics();
     
      // TODO lazy deserialization?
     
      legacy.loaders()
         .passivation(config.loaders().passivation())
         .preload(config.loaders().preload())
         .shared(config.loaders().shared());

      for (AbstractLoaderConfiguration loader : config.loaders().cacheLoaders()) {
         CacheLoaderConfig clc = null;
         if (loader instanceof LoaderConfiguration) {
            CacheLoader cacheLoader = ((LoaderConfiguration) loader).cacheLoader();
            if (cacheLoader.getClass().isAnnotationPresent(CacheLoaderMetadata.class)) {
               clc = Util.getInstance(cacheLoader.getClass().getAnnotation(CacheLoaderMetadata.class).configurationClass());
            } else {
               AbstractCacheStoreConfig acsc = new AbstractCacheStoreConfig();
               acsc.setCacheLoaderClassName(((LoaderConfiguration) loader).cacheLoader().getClass().getName());
               clc = acsc;
            }
           
         } else if (loader instanceof FileCacheStoreConfiguration) {
            FileCacheStoreConfig fcsc = new FileCacheStoreConfig();
            clc = fcsc;
            FileCacheStoreConfiguration store = (FileCacheStoreConfiguration) loader;
            if (store.location() != null) {
               fcsc.location(store.location());
            }
            if (store.fsyncMode() != null) {
               fcsc.fsyncMode(FileCacheStoreConfig.FsyncMode.valueOf(store.fsyncMode().name()));
            }
            fcsc.fsyncInterval(store.fsyncInterval());
            fcsc.streamBufferSize(store.streamBufferSize());
         }
         if (clc instanceof CacheStoreConfig) {
            CacheStoreConfig csc = (CacheStoreConfig) clc;
            csc.fetchPersistentState(loader.fetchPersistentState());
            csc.ignoreModifications(loader.ignoreModifications());
            csc.purgeOnStartup(loader.purgeOnStartup())
            csc.setPurgeSynchronously(loader.purgeSynchronously());
            csc.getAsyncStoreConfig().setEnabled(loader.async().enabled());
            csc.getAsyncStoreConfig().flushLockTimeout(loader.async().flushLockTimeout());
            csc.getAsyncStoreConfig().modificationQueueSize(loader.async().modificationQueueSize());
            csc.getAsyncStoreConfig().shutdownTimeout(loader.async().shutdownTimeout());
            csc.getAsyncStoreConfig().threadPoolSize(loader.async().threadPoolSize());
           
            csc.getSingletonStoreConfig().enabled(loader.singletonStore().enabled());
            csc.getSingletonStoreConfig().pushStateTimeout(loader.singletonStore().pushStateTimeout());
            csc.getSingletonStoreConfig().pushStateWhenCoordinator(loader.singletonStore().pushStateWhenCoordinator());
         }
         if (clc instanceof AbstractCacheStoreConfig) {
            AbstractCacheStoreConfig acsc = (AbstractCacheStoreConfig) clc;
            Properties p = loader.properties();
            acsc.setProperties(p);
            if (p != null) XmlConfigHelper.setValues(clc, p, false, true);
            if (loader instanceof LoaderConfiguration)
               acsc.purgerThreads(((LoaderConfiguration) loader).purgerThreads());
         }
        
         legacy.loaders().addCacheLoader(clc);
      }
     
      legacy.locking()
         .concurrencyLevel(config.locking().concurrencyLevel())
         .isolationLevel(config.locking().isolationLevel())
         .lockAcquisitionTimeout(config.locking().lockAcquisitionTimeout())
         .useLockStriping(config.locking().useLockStriping())
         .writeSkewCheck(config.locking().writeSkewCheck());
     
      if (config.storeAsBinary().enabled())
         legacy.storeAsBinary()
            .storeKeysAsBinary(config.storeAsBinary().storeKeysAsBinary())
            .storeValuesAsBinary(config.storeAsBinary().storeValuesAsBinary());
      else
         legacy.storeAsBinary()
            .disable();
  
      legacy.transaction()
         .autoCommit(config.transaction().autoCommit())
         .cacheStopTimeout((int) config.transaction().cacheStopTimeout())
         .eagerLockSingleNode(config.transaction().eagerLockingSingleNode())
         .lockingMode(config.transaction().lockingMode())
         .syncCommitPhase(config.transaction().syncCommitPhase())
         .syncRollbackPhase(config.transaction().syncRollbackPhase())
         .transactionManagerLookup(config.transaction().transactionManagerLookup())
         .transactionMode(config.transaction().transactionMode())
         .transactionSynchronizationRegistryLookup(config.transaction().transactionSynchronizationRegistryLookup())
         .useEagerLocking(config.transaction().useEagerLocking())
         .useSynchronization(config.transaction().useSynchronization())
         .use1PcForAutoCommitTransactions(config.transaction().use1PcForAutoCommitTransactions());
     
      if (config.transaction().recovery().enabled()) {
         legacy.transaction().recovery().recoveryInfoCacheName(config.transaction().recovery().recoveryInfoCacheName());
      }
       
      legacy.unsafe().unreliableReturnValues(config.unsafe().unreliableReturnValues());

      if (config.versioning().enabled()) {
         legacy.versioning()
               .enable()
               .versioningScheme(config.versioning().scheme());
      }
     
      return legacy.build();
   }
View Full Code Here

         }
         if (indexing != null) {
            dolly.indexing = indexing.clone();
            dolly.indexing.setConfiguration(dolly);
         }
         dolly.fluentConfig = new FluentConfiguration(dolly);
         return dolly;
      } catch (CloneNotSupportedException e) {
         throw new CacheException("Unexpected!", e);
      }
   }
View Full Code Here

        boolean requiresTransport = false;
        Map<String, Configuration> configurations = config.getConfigurations();
        for (ModelNode cache : operation.require(ModelKeys.CACHE).asList()) {
            String cacheName = cache.require(ModelKeys.NAME).asString();
            Configuration configuration = new Configuration();
            FluentConfiguration fluent = configuration.fluent();
            Configuration.CacheMode mode = CacheMode.valueOf(cache.require(ModelKeys.MODE).asString());
            requiresTransport |= mode.isClustered();
            fluent.mode(mode);
            if (cache.hasDefined(ModelKeys.BATCHING)) {
                if (cache.get(ModelKeys.BATCHING).asBoolean()) {
                    fluent.invocationBatching();
                }
            }
            if (cache.hasDefined(ModelKeys.INDEXING)) {
                Indexing indexing = Indexing.valueOf(cache.get(ModelKeys.INDEXING).asString());
                if (indexing.isEnabled()) {
                    fluent.indexing().indexLocalOnly(indexing.isLocalOnly());
                }
            }
            if (cache.hasDefined(ModelKeys.QUEUE_SIZE)) {
                fluent.async().replQueueMaxElements(cache.get(ModelKeys.QUEUE_SIZE).asInt());
            }
            if (cache.hasDefined(ModelKeys.QUEUE_FLUSH_INTERVAL)) {
                fluent.async().replQueueInterval(cache.get(ModelKeys.QUEUE_FLUSH_INTERVAL).asLong());
            }
            if (cache.hasDefined(ModelKeys.REMOTE_TIMEOUT)) {
                fluent.sync().replTimeout(cache.get(ModelKeys.REMOTE_TIMEOUT).asLong());
            }
            if (cache.hasDefined(ModelKeys.OWNERS)) {
                fluent.hash().numOwners(cache.get(ModelKeys.OWNERS).asInt());
            }
            if (cache.hasDefined(ModelKeys.VIRTUAL_NODES)) {
                fluent.hash().numVirtualNodes(cache.get(ModelKeys.VIRTUAL_NODES).asInt());
            }
            if (cache.hasDefined(ModelKeys.L1_LIFESPAN)) {
                long lifespan = cache.get(ModelKeys.L1_LIFESPAN).asLong();
                if (lifespan > 0) {
                    fluent.l1().lifespan(lifespan);
                } else {
                    fluent.l1().disable();
                }
            }
            if (cache.hasDefined(ModelKeys.LOCKING)) {
                ModelNode locking = cache.get(ModelKeys.LOCKING);
                FluentConfiguration.LockingConfig fluentLocking = fluent.locking();
                if (locking.hasDefined(ModelKeys.ISOLATION)) {
                    fluentLocking.isolationLevel(IsolationLevel.valueOf(locking.get(ModelKeys.ISOLATION).asString()));
                }
                if (locking.hasDefined(ModelKeys.STRIPING)) {
                    fluentLocking.useLockStriping(locking.get(ModelKeys.STRIPING).asBoolean());
                }
                if (locking.hasDefined(ModelKeys.ACQUIRE_TIMEOUT)) {
                    fluentLocking.lockAcquisitionTimeout(locking.get(ModelKeys.ACQUIRE_TIMEOUT).asLong());
                }
                if (locking.hasDefined(ModelKeys.CONCURRENCY_LEVEL)) {
                    fluentLocking.concurrencyLevel(locking.get(ModelKeys.CONCURRENCY_LEVEL).asInt());
                }
            }
            FluentConfiguration.TransactionConfig fluentTx = fluent.transaction();
            TransactionMode txMode = TransactionMode.NON_XA;
            if (cache.hasDefined(ModelKeys.TRANSACTION)) {
                ModelNode transaction = cache.get(ModelKeys.TRANSACTION);
                if (transaction.hasDefined(ModelKeys.STOP_TIMEOUT)) {
                    fluentTx.cacheStopTimeout(transaction.get(ModelKeys.STOP_TIMEOUT).asInt());
                }
                if (transaction.hasDefined(ModelKeys.MODE)) {
                    txMode = TransactionMode.valueOf(transaction.get(ModelKeys.MODE).asString());
                }
                if (transaction.hasDefined(ModelKeys.EAGER_LOCKING)) {
                    EagerLocking eager = EagerLocking.valueOf(transaction.get(ModelKeys.EAGER_LOCKING).asString());
                    fluentTx.useEagerLocking(eager.isEnabled()).eagerLockSingleNode(eager.isSingleOwner());
                }
            }
            FluentConfiguration.RecoveryConfig recovery = fluentTx.useSynchronization(!txMode.isXAEnabled()).recovery();
            if (txMode.isRecoveryEnabled()) {
                recovery.syncCommitPhase(true).syncRollbackPhase(true);
            } else {
                recovery.disable();
            }
            if (cache.hasDefined(ModelKeys.EVICTION)) {
                ModelNode eviction = cache.get(ModelKeys.EVICTION);
                FluentConfiguration.EvictionConfig fluentEviction = fluent.eviction();
                if (eviction.hasDefined(ModelKeys.STRATEGY)) {
                    fluentEviction.strategy(EvictionStrategy.valueOf(eviction.get(ModelKeys.STRATEGY).asString()));
                }
                if (eviction.hasDefined(ModelKeys.MAX_ENTRIES)) {
                    fluentEviction.maxEntries(eviction.get(ModelKeys.MAX_ENTRIES).asInt());
                }
            }
            if (cache.hasDefined(ModelKeys.EXPIRATION)) {
                ModelNode expiration = cache.get(ModelKeys.EXPIRATION);
                FluentConfiguration.ExpirationConfig fluentExpiration = fluent.expiration();
                if (expiration.hasDefined(ModelKeys.MAX_IDLE)) {
                    fluentExpiration.maxIdle(expiration.get(ModelKeys.MAX_IDLE).asLong());
                }
                if (expiration.hasDefined(ModelKeys.LIFESPAN)) {
                    fluentExpiration.lifespan(expiration.get(ModelKeys.LIFESPAN).asLong());
                }
                if (expiration.hasDefined(ModelKeys.INTERVAL)) {
                    fluentExpiration.wakeUpInterval(expiration.get(ModelKeys.INTERVAL).asLong());
                }
            }
            if (cache.hasDefined(ModelKeys.STATE_TRANSFER)) {
                ModelNode stateTransfer = cache.get(ModelKeys.STATE_TRANSFER);
                FluentConfiguration.StateRetrievalConfig fluentStateTransfer = fluent.stateRetrieval();
                if (stateTransfer.hasDefined(ModelKeys.ENABLED)) {
                    fluentStateTransfer.fetchInMemoryState(stateTransfer.get(ModelKeys.ENABLED).asBoolean());
                }
                if (stateTransfer.hasDefined(ModelKeys.TIMEOUT)) {
                    fluentStateTransfer.timeout(stateTransfer.get(ModelKeys.TIMEOUT).asLong());
                }
                if (stateTransfer.hasDefined(ModelKeys.FLUSH_TIMEOUT)) {
                    fluentStateTransfer.logFlushTimeout(stateTransfer.get(ModelKeys.FLUSH_TIMEOUT).asLong());
                }
            }
            if (cache.hasDefined(ModelKeys.REHASHING)) {
                ModelNode rehashing = cache.get(ModelKeys.REHASHING);
                FluentConfiguration.HashConfig fluentHash = fluent.hash();
                if (rehashing.hasDefined(ModelKeys.ENABLED)) {
                    fluentHash.rehashEnabled(rehashing.get(ModelKeys.ENABLED).asBoolean());
                }
                if (rehashing.hasDefined(ModelKeys.TIMEOUT)) {
                    fluentHash.rehashRpcTimeout(rehashing.get(ModelKeys.TIMEOUT).asLong());
                }
            }
            if (cache.hasDefined(ModelKeys.STORE)) {
                ModelNode store = cache.get(ModelKeys.STORE);
                FluentConfiguration.LoadersConfig fluentStores = fluent.loaders();
                fluentStores.shared(store.hasDefined(ModelKeys.SHARED) ? store.get(ModelKeys.SHARED).asBoolean() : false);
                fluentStores.preload(store.hasDefined(ModelKeys.PRELOAD) ? store.get(ModelKeys.PRELOAD).asBoolean() : false);
                fluentStores.passivation(store.hasDefined(ModelKeys.PASSIVATION) ? store.get(ModelKeys.PASSIVATION).asBoolean() : true);
                CacheStoreConfig storeConfig = buildCacheStore(name, builder, store);
                storeConfig.singletonStore().enabled(store.hasDefined(ModelKeys.SINGLETON) ? store.get(ModelKeys.SINGLETON).asBoolean() : false);
View Full Code Here

TOP

Related Classes of org.infinispan.config.FluentConfiguration$LazyDeserializationConfig

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.