예제 #1
0
 /**
  * Create the default configuration.
  *
  * @return the default cache configuration.
  */
 protected ConfigurationBuilder createDefaultConfigurationBuilder() {
   ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
   configurationBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);
   configurationBuilder.transaction().transactionManagerLookup(transactionManagerLookupInstance());
   configurationBuilder.transaction().lockingMode(LockingMode.PESSIMISTIC);
   return configurationBuilder;
 }
 protected ConfigurationBuilder getConfig() {
   ConfigurationBuilder dcc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true);
   dcc.transaction().locking().writeSkewCheck(true);
   dcc.transaction().locking().isolationLevel(IsolationLevel.REPEATABLE_READ);
   dcc.transaction().versioning().enable().scheme(VersioningScheme.SIMPLE);
   return dcc;
 }
  public void testCorrectShutdown() {
    CacheContainer cc = null;

    try {
      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg.transaction()
          .transactionMode(TransactionMode.TRANSACTIONAL)
          .indexing()
          .index(Index.ALL)
          .addProperty("default.directory_provider", "ram")
          .addProperty("lucene_version", "LUCENE_CURRENT");
      cc = TestCacheManagerFactory.createCacheManager(cfg);
      Cache<?, ?> cache = cc.getCache();
      SearchFactoryIntegrator sfi =
          TestingUtil.extractComponent(cache, SearchFactoryIntegrator.class);

      assert !sfi.isStopped();

      cc.stop();

      assert sfi.isStopped();
    } finally {
      // proper cleanup for exceptional execution
      TestingUtil.killCacheManagers(cc);
    }
  }
 @Override
 protected ConfigurationBuilder createCacheConfigBuilder() {
   ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true);
   c.clustering().hash().numOwners(100).numSegments(4).l1().disable();
   c.transaction().transactionProtocol(TransactionProtocol.TOTAL_ORDER).recovery().disable();
   return c;
 }
  private ConfigurationBuilder getCB() {
    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.clustering()
        .cacheMode(CacheMode.DIST_SYNC)
        .sync()
        .replTimeout(60000)
        .stateTransfer()
        .timeout(180000)
        .fetchInMemoryState(true)
        .hash()
        .numOwners(1);

    // transactions

    cb.transaction()
        .transactionMode(TransactionMode.TRANSACTIONAL)
        .lockingMode(LockingMode.PESSIMISTIC)
        .syncCommitPhase(true)
        .syncRollbackPhase(true);

    // cb.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL);

    cb.loaders().passivation(false).preload(true).shared(true);
    // Make it really shared by adding the test's name as store name
    cb.loaders()
        .addStore(DummyInMemoryCacheStoreConfigurationBuilder.class)
        .storeName(getClass().getSimpleName())
        .async()
        .disable();
    return cb;
  }
  @Override
  protected EmbeddedCacheManager createCacheManager() throws Exception {
    cacheStoreDir = new File(TestingUtil.tmpDirectory(this.getClass()));
    TestingUtil.recursiveFileRemove(cacheStoreDir);

    ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.LOCAL, true, true);
    builder
        .transaction()
        .transactionMode(TransactionMode.TRANSACTIONAL)
        .lockingMode(LockingMode.PESSIMISTIC)
        .transactionManagerLookup(new DummyTransactionManagerLookup())
        .eviction()
        .maxEntries(150)
        .strategy(EvictionStrategy.LIRS)
        .locking()
        .lockAcquisitionTimeout(20000)
        .concurrencyLevel(5000)
        .useLockStriping(false)
        .writeSkewCheck(false)
        .isolationLevel(IsolationLevel.READ_COMMITTED)
        .dataContainer()
        .storeAsBinary()
        .persistence()
        .passivation(passivationEnabled)
        .addSingleFileStore()
        .location(cacheStoreDir.getAbsolutePath())
        .fetchPersistentState(true)
        .ignoreModifications(false)
        .preload(false)
        .purgeOnStartup(false);

    configureConfiguration(builder);

    return TestCacheManagerFactory.createCacheManager(builder);
  }
예제 #7
0
 @Override
 protected EmbeddedCacheManager createCacheManager() throws Exception {
   ConfigurationBuilder configuration = getDefaultClusteredCacheConfig(CacheMode.LOCAL, true);
   configuration.transaction().lockingMode(LockingMode.PESSIMISTIC);
   configure(configuration);
   return TestCacheManagerFactory.createCacheManager(configuration);
 }
  @Override
  protected void createCacheManagers() throws Throwable {
    // todo [anistor] initializing the server-side context in this way is a hack. normally this
    // should use the protobuf metadata registry
    MarshallerRegistration.registerMarshallers(
        SerializationContextHolder.getSerializationContext());

    // initialize client-side serialization context
    MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext());

    ConfigurationBuilder builder =
        hotRodCacheConfiguration(getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false));
    builder
        .transaction()
        .indexing()
        .enable()
        .indexLocalOnly(false)
        .addProperty(
            "default.directory_provider", "ram") // todo test with  "infinispan" provider too
        .addProperty("lucene_version", "LUCENE_CURRENT");

    builder.dataContainer().valueEquivalence(AnyEquivalence.getInstance()); // TODO [anistor] hacks!

    createHotRodServers(2, builder);
  }
 @Override
 protected void createCacheManagers() throws Throwable {
   ConfigurationBuilder config = new ConfigurationBuilder();
   config.clustering().cacheMode(CacheMode.DIST_SYNC);
   config.transaction().lockingMode(LockingMode.OPTIMISTIC);
   config
       .clustering()
       .hash()
       .numSegments(1)
       .consistentHashFactory(new ControlledConsistentHashFactory(1, 0));
   config
       .transaction()
       .transactionManagerLookup(new DummyTransactionManagerLookup())
       .cacheStopTimeout(1, SECONDS);
   createCluster(config, 2);
   waitForClusterToForm();
 }
예제 #10
0
 @Test
 public void testDummyTMGetCache() {
   ConfigurationBuilder cb = new ConfigurationBuilder();
   cb.transaction()
       .use1PcForAutoCommitTransactions(true)
       .transactionManagerLookup(new DummyTransactionManagerLookup());
   DefaultCacheManager cm = new DefaultCacheManager(cb.build());
   cm.getCache();
 }
 @Override
 protected void createCacheManagers() throws Throwable {
   dccc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true);
   dccc.transaction().transactionManagerLookup(new DummyTransactionManagerLookup());
   dccc.clustering().hash().l1().disable().locking().lockAcquisitionTimeout(1000l);
   dccc.clustering().stateTransfer().fetchInMemoryState(true);
   createCluster(dccc, 2);
   waitForClusterToForm();
 }
  @Override
  protected void createCacheManagers() {
    cacheConfigBuilder = getDefaultClusteredCacheConfig(cacheMode, isTransactional, true);
    if (isTransactional) {
      cacheConfigBuilder
          .transaction()
          .transactionMode(TransactionMode.TRANSACTIONAL)
          .transactionManagerLookup(new DummyTransactionManagerLookup())
          .syncCommitPhase(true)
          .syncRollbackPhase(true);

      if (isOptimistic) {
        cacheConfigBuilder
            .transaction()
            .lockingMode(LockingMode.OPTIMISTIC)
            .locking()
            .writeSkewCheck(true)
            .isolationLevel(IsolationLevel.REPEATABLE_READ)
            .versioning()
            .enable()
            .scheme(VersioningScheme.SIMPLE);
      } else {
        cacheConfigBuilder.transaction().lockingMode(LockingMode.PESSIMISTIC);
      }
    }
    cacheConfigBuilder
        .clustering()
        .hash()
        .numSegments(10)
        .numOwners(2)
        .l1()
        .disable()
        .locking()
        .lockAcquisitionTimeout(1000l);
    cacheConfigBuilder
        .clustering()
        .stateTransfer()
        .fetchInMemoryState(true)
        .awaitInitialTransfer(false);

    addClusterEnabledCacheManager(cacheConfigBuilder);
    waitForClusterToForm();
  }
 protected EmbeddedCacheManager createCacheManager() throws Exception {
   ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(true);
   cfg.transaction()
       .transactionMode(TransactionMode.TRANSACTIONAL)
       .indexing()
       .index(Index.ALL)
       .addProperty("default.directory_provider", "ram")
       .addProperty("lucene_version", "LUCENE_CURRENT");
   return TestCacheManagerFactory.createCacheManager(cfg);
 }
예제 #14
0
 @Test(expectedExceptions = CacheConfigurationException.class)
 public void testRecoveryAndAsyncCommitPhaseCaches() {
   // Note: this configuration uses Xa Enlistment (see configs/recovery-enabled-config.xml).
   Configuration defaultConfig = cacheManager.getDefaultCacheConfiguration();
   ConfigurationBuilder builder = new ConfigurationBuilder().read(defaultConfig);
   builder.clustering().cacheMode(CacheMode.REPL_SYNC);
   builder.transaction().syncCommitPhase(false).recovery().enable();
   // it should throw an exception when try to build this configuration.
   builder.build();
 }
 protected ConfigurationBuilder createConfiguration() {
   ConfigurationBuilder configuration = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true);
   configuration
       .transaction()
       .lockingMode(LockingMode.PESSIMISTIC)
       .locking()
       .useLockStriping(false)
       .deadlockDetection()
       .enable();
   return configuration;
 }
예제 #16
0
 @Override
 protected void createCacheManagers() throws Throwable {
   ConfigurationBuilder builder = new ConfigurationBuilder();
   builder.clustering().cacheMode(cacheMode);
   builder.transaction().transactionMode(transactionMode()).lockingMode(lockingMode);
   builder.clustering().partitionHandling().enabled(true);
   for (int i = 0; i < NUM_NODES; i++) {
     addClusterEnabledCacheManager(builder, new TransportFlags().withFD(true).withMerge(true));
   }
   waitForClusterToForm();
 }
 @Override
 protected void createCacheManagers() throws Throwable {
   super.createCacheManagers();
   ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC);
   builder.clustering().partitionHandling().enabled(true);
   builder
       .transaction()
       .lockingMode(LockingMode.OPTIMISTIC)
       .transactionMode(TransactionMode.TRANSACTIONAL)
       .transactionManagerLookup(new DummyTransactionManagerLookup());
   defineConfigurationOnAllManagers(OPTIMISTIC_TX_CACHE_NAME, builder);
 }
 @Override
 protected void createCacheManagers() throws Throwable {
   dcc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true);
   dcc.transaction().transactionManagerLookup(new DummyTransactionManagerLookup());
   consistentHashFactory = new ControlledConsistentHashFactory(1);
   dcc.clustering()
       .hash()
       .numOwners(1)
       .numSegments(1)
       .consistentHashFactory(consistentHashFactory);
   createCluster(dcc, 2);
   waitForClusterToForm();
 }
예제 #19
0
 @Test
 public void testCacheManager() {
   ConfigurationBuilder builder = new ConfigurationBuilder();
   builder.transaction().invocationBatching().enable();
   EmbeddedCacheManager cm = new DefaultCacheManager(builder.build());
   Cache<String, String> cache = cm.getCache();
   TreeCacheFactory tcf = new TreeCacheFactory();
   TreeCache<String, String> tree = tcf.createTreeCache(cache);
   Fqn leafFqn = Fqn.fromElements("branch", "leaf");
   Node<String, String> leaf = tree.getRoot().addChild(leafFqn);
   leaf.put("fruit", "orange");
   cm.stop();
 }
 @Test
 public void testDummyTMGetCache() throws Exception {
   ConfigurationBuilder cb = new ConfigurationBuilder();
   cb.transaction()
       .use1PcForAutoCommitTransactions(true)
       .transactionManagerLookup(new DummyTransactionManagerLookup());
   withCacheManager(
       new CacheManagerCallable(createCacheManager()) {
         @Override
         public void call() {
           cm.getCache();
         }
       });
 }
 @Override
 protected void createCacheManagers() throws Throwable {
   ConfigurationBuilder cacheCfg =
       getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, transactionsEnabled());
   cacheCfg.transaction().lockingMode(LockingMode.PESSIMISTIC);
   cacheCfg
       .indexing()
       .index(Index.ALL)
       .addProperty("default.directory_provider", "ram")
       .addProperty("lucene_version", "LUCENE_CURRENT");
   enhanceConfig(cacheCfg);
   List<Cache<String, Person>> caches = createClusteredCaches(2, cacheCfg);
   cache1 = caches.get(0);
   cache2 = caches.get(1);
 }
예제 #22
0
  @Override
  protected void createCacheManagers() throws Throwable {
    consistentHashFactory = new ControlledConsistentHashFactory(1, 2);

    ConfigurationBuilder builder = new ConfigurationBuilder();
    builder.clustering().cacheMode(CacheMode.DIST_SYNC);
    builder.clustering().remoteTimeout(2000);
    builder.clustering().hash().numSegments(1).consistentHashFactory(consistentHashFactory);
    builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL);

    addClusterEnabledCacheManager(builder);
    addClusterEnabledCacheManager(builder);
    addClusterEnabledCacheManager(builder);
    waitForClusterToForm();
  }
예제 #23
0
  @Test(expectedExceptions = IllegalStateException.class)
  public void testAtomicMapNonTransactionWithoutBatchSet() {
    ConfigurationBuilder builder = buildConfiguration();
    builder.invocationBatching().disable();
    builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL);
    cacheManager.defineConfiguration("ahm_no_tx_without_batch", builder.build());
    Cache<String, String> ahmCache = cacheManager.getCache("ahm_no_tx_without_batch");

    AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(ahmCache, "key");
    assert map.isEmpty();
    map.put("a", "b");
    assert map.get("a").equals("b");

    // now re-retrieve the map and make sure we see the diffs
    assert AtomicMapLookup.getAtomicMap(ahmCache, "key").get("a").equals("b");
  }
예제 #24
0
 protected ConfigurationBuilder buildConfiguration() {
   ConfigurationBuilder c = getDefaultClusteredCacheConfig(cacheMode, true);
   c.transaction()
       .transactionManagerLookup(new DummyTransactionManagerLookup())
       .useSynchronization(useSynchronization)
       .lockingMode(lockingMode)
       .recovery()
       .disable()
       .clustering()
       .l1()
       .disable()
       .hash()
       .numOwners(3)
       .stateTransfer()
       .fetchInMemoryState(false);
   return c;
 }
예제 #25
0
  public void testAtomicMapWithoutTransactionManagerLookupSet() {
    ConfigurationBuilder builder = buildConfiguration();
    builder
        .transaction()
        .transactionMode(TransactionMode.TRANSACTIONAL)
        .transactionManagerLookup(null);
    cacheManager.defineConfiguration("ahm_without_tmlookup", builder.build());
    Cache<String, String> ahmCache = cacheManager.getCache("ahm_without_tmlookup");

    AtomicMap<String, String> map = AtomicMapLookup.getAtomicMap(ahmCache, "key");
    assert map.isEmpty();
    map.put("a", "b");
    assert map.get("a").equals("b");

    // now re-retrieve the map and make sure we see the diffs
    assert AtomicMapLookup.getAtomicMap(ahmCache, "key").get("a").equals("b");
  }
  @Override
  public ConfigurationBuilder createConfigurationBuilder() {
    ConfigurationBuilder builder = new ConfigurationBuilder();

    EvictionConfiguration eviction = this.eviction.getValue();
    ExpirationConfiguration expiration = this.expiration.getValue();
    LockingConfiguration locking = this.locking.getValue();
    PersistenceConfiguration persistence = this.persistence.getValue();
    TransactionConfiguration transaction = this.transaction.getValue();

    builder.eviction().read(eviction);
    builder.expiration().read(expiration);
    builder.locking().read(locking);
    builder.persistence().read(persistence);
    builder.transaction().read(transaction);
    builder.jmxStatistics().read(this.statistics);

    return builder;
  }
예제 #27
0
  protected static EmbeddedCacheManager createCacheManager() throws Exception {
    GlobalConfigurationBuilder gcfg = new GlobalConfigurationBuilder();
    gcfg.globalJmxStatistics().allowDuplicateDomains(true);

    ConfigurationBuilder cfg = new ConfigurationBuilder();
    cfg.transaction()
        .transactionMode(TransactionMode.TRANSACTIONAL)
        .indexing()
        .index(Index.ALL)
        .addProperty("default.directory_provider", "ram")
        .addProperty(
            "error_handler",
            "org.infinispan.all.embeddedquery.testdomain.StaticTestingErrorHandler")
        .addProperty("lucene_version", "LUCENE_CURRENT");

    EmbeddedCacheManager cm = new DefaultCacheManager(gcfg.build(), cfg.build());

    return cm;
  }
 @Override
 protected void createCacheManagers() throws Throwable {
   dccc = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true);
   dccc.transaction()
       .transactionManagerLookup(new DummyTransactionManagerLookup())
       .lockingMode(LockingMode.PESSIMISTIC)
       .syncCommitPhase(true)
       .syncRollbackPhase(true)
       .locking()
       .lockAcquisitionTimeout(1000l)
       .clustering()
       .hash()
       .numOwners(1)
       .numSegments(3)
       .l1()
       .disable()
       .onRehash(false)
       .stateTransfer()
       .fetchInMemoryState(true);
   createCluster(dccc, 2);
   waitForClusterToForm();
 }
예제 #29
0
  /**
   * Create a Configuration object initialized from the operation ModelNode
   *
   * @param containerName the name of the cache container
   * @param cache ModelNode representing cache configuration
   * @param builder ConfigurationBuilder object to add data to
   * @return initialised Configuration object
   */
  void processModelNode(
      OperationContext context,
      String containerName,
      ModelNode cache,
      ConfigurationBuilder builder,
      List<Dependency<?>> dependencies)
      throws OperationFailedException {

    final Indexing indexing =
        Indexing.valueOf(
            CommonAttributes.INDEXING.resolveModelAttribute(context, cache).asString());
    final boolean batching =
        CommonAttributes.BATCHING.resolveModelAttribute(context, cache).asBoolean();

    // set the cache mode (may be modified when setting up clustering attributes)
    builder.clustering().cacheMode(this.mode);
    final ModelNode indexingPropertiesModel =
        CommonAttributes.INDEXING_PROPERTIES.resolveModelAttribute(context, cache);
    Properties indexingProperties = new Properties();
    if (indexing.isEnabled() && indexingPropertiesModel.isDefined()) {
      for (Property p : indexingPropertiesModel.asPropertyList()) {
        String value = p.getValue().asString();
        indexingProperties.put(p.getName(), value);
      }
    }
    builder
        .indexing()
        .enabled(indexing.isEnabled())
        .indexLocalOnly(indexing.isLocalOnly())
        .withProperties(indexingProperties);

    // locking is a child resource
    if (cache.hasDefined(ModelKeys.LOCKING)
        && cache.get(ModelKeys.LOCKING, ModelKeys.LOCKING_NAME).isDefined()) {
      ModelNode locking = cache.get(ModelKeys.LOCKING, ModelKeys.LOCKING_NAME);

      final IsolationLevel isolationLevel =
          IsolationLevel.valueOf(
              CommonAttributes.ISOLATION.resolveModelAttribute(context, locking).asString());
      final boolean striping =
          CommonAttributes.STRIPING.resolveModelAttribute(context, locking).asBoolean();
      final long acquireTimeout =
          CommonAttributes.ACQUIRE_TIMEOUT.resolveModelAttribute(context, locking).asLong();
      final int concurrencyLevel =
          CommonAttributes.CONCURRENCY_LEVEL.resolveModelAttribute(context, locking).asInt();

      builder
          .locking()
          .isolationLevel(isolationLevel)
          .useLockStriping(striping)
          .lockAcquisitionTimeout(acquireTimeout)
          .concurrencyLevel(concurrencyLevel);
    }

    TransactionMode txMode = TransactionMode.NONE;
    LockingMode lockingMode = LockingMode.OPTIMISTIC;
    // locking is a child resource
    if (cache.hasDefined(ModelKeys.TRANSACTION)
        && cache.get(ModelKeys.TRANSACTION, ModelKeys.TRANSACTION_NAME).isDefined()) {
      ModelNode transaction = cache.get(ModelKeys.TRANSACTION, ModelKeys.TRANSACTION_NAME);

      final long stopTimeout =
          CommonAttributes.STOP_TIMEOUT.resolveModelAttribute(context, transaction).asLong();
      txMode =
          TransactionMode.valueOf(
              CommonAttributes.MODE.resolveModelAttribute(context, transaction).asString());
      lockingMode =
          LockingMode.valueOf(
              CommonAttributes.LOCKING.resolveModelAttribute(context, transaction).asString());

      builder.transaction().cacheStopTimeout(stopTimeout);
    }
    builder
        .transaction()
        .transactionMode(txMode.getMode())
        .lockingMode(lockingMode)
        .useSynchronization(!txMode.isXAEnabled())
        .recovery()
        .enabled(txMode.isRecoveryEnabled());
    if (txMode.isRecoveryEnabled()) {
      builder.transaction().syncCommitPhase(true).syncRollbackPhase(true);
    }

    if (batching) {
      builder
          .transaction()
          .transactionMode(org.infinispan.transaction.TransactionMode.TRANSACTIONAL)
          .invocationBatching()
          .enable();
    } else {
      builder.transaction().invocationBatching().disable();
    }

    // eviction is a child resource
    if (cache.hasDefined(ModelKeys.EVICTION)
        && cache.get(ModelKeys.EVICTION, ModelKeys.EVICTION_NAME).isDefined()) {
      ModelNode eviction = cache.get(ModelKeys.EVICTION, ModelKeys.EVICTION_NAME);

      final EvictionStrategy strategy =
          EvictionStrategy.valueOf(
              CommonAttributes.EVICTION_STRATEGY
                  .resolveModelAttribute(context, eviction)
                  .asString());
      builder.eviction().strategy(strategy);

      if (strategy.isEnabled()) {
        final int maxEntries =
            CommonAttributes.MAX_ENTRIES.resolveModelAttribute(context, eviction).asInt();
        builder.eviction().maxEntries(maxEntries);
      }
    }
    // expiration is a child resource
    if (cache.hasDefined(ModelKeys.EXPIRATION)
        && cache.get(ModelKeys.EXPIRATION, ModelKeys.EXPIRATION_NAME).isDefined()) {

      ModelNode expiration = cache.get(ModelKeys.EXPIRATION, ModelKeys.EXPIRATION_NAME);

      final long maxIdle =
          CommonAttributes.MAX_IDLE.resolveModelAttribute(context, expiration).asLong();
      final long lifespan =
          CommonAttributes.LIFESPAN.resolveModelAttribute(context, expiration).asLong();
      final long interval =
          CommonAttributes.INTERVAL.resolveModelAttribute(context, expiration).asLong();

      builder.expiration().maxIdle(maxIdle).lifespan(lifespan).wakeUpInterval(interval);
      // Only enable the reaper thread if we need it
      if ((maxIdle > 0) || (lifespan > 0)) {
        builder.expiration().enableReaper();
      } else {
        builder.expiration().disableReaper();
      }
    }

    // stores are a child resource
    String storeKey = this.findStoreKey(cache);
    if (storeKey != null) {
      ModelNode store = this.getStoreModelNode(cache);

      final boolean shared =
          CommonAttributes.SHARED.resolveModelAttribute(context, store).asBoolean();
      final boolean preload =
          CommonAttributes.PRELOAD.resolveModelAttribute(context, store).asBoolean();
      final boolean passivation =
          CommonAttributes.PASSIVATION.resolveModelAttribute(context, store).asBoolean();
      final boolean fetchState =
          CommonAttributes.FETCH_STATE.resolveModelAttribute(context, store).asBoolean();
      final boolean purge =
          CommonAttributes.PURGE.resolveModelAttribute(context, store).asBoolean();
      final boolean singleton =
          CommonAttributes.SINGLETON.resolveModelAttribute(context, store).asBoolean();
      final boolean async =
          store.hasDefined(ModelKeys.WRITE_BEHIND)
              && store.get(ModelKeys.WRITE_BEHIND, ModelKeys.WRITE_BEHIND_NAME).isDefined();

      builder.loaders().shared(shared).preload(preload).passivation(passivation);
      LoaderConfigurationBuilder storeBuilder =
          builder
              .loaders()
              .addCacheLoader()
              .fetchPersistentState(fetchState)
              .purgeOnStartup(purge)
              .purgeSynchronously(true);
      storeBuilder.singletonStore().enabled(singleton);

      if (async) {
        ModelNode writeBehind = store.get(ModelKeys.WRITE_BEHIND, ModelKeys.WRITE_BEHIND_NAME);
        storeBuilder
            .async()
            .enable()
            .flushLockTimeout(
                CommonAttributes.FLUSH_LOCK_TIMEOUT
                    .resolveModelAttribute(context, writeBehind)
                    .asLong())
            .modificationQueueSize(
                CommonAttributes.MODIFICATION_QUEUE_SIZE
                    .resolveModelAttribute(context, writeBehind)
                    .asInt())
            .shutdownTimeout(
                CommonAttributes.SHUTDOWN_TIMEOUT
                    .resolveModelAttribute(context, writeBehind)
                    .asLong())
            .threadPoolSize(
                CommonAttributes.THREAD_POOL_SIZE
                    .resolveModelAttribute(context, writeBehind)
                    .asInt());
      }

      this.buildCacheStore(context, storeBuilder, containerName, store, storeKey, dependencies);
    }
  }
 @Override
 protected void decorate(ConfigurationBuilder builder) {
   super.decorate(builder);
   builder.transaction().transactionProtocol(TransactionProtocol.TOTAL_ORDER).recovery().disable();
 }