Ejemplo n.º 1
0
  protected Cache<String, String> startCache() throws IOException {
    CacheBuilder cb = new CacheBuilder(cfgFile);
    EmbeddedCacheManager cacheManager = cb.getCacheManager();
    Configuration dcc = cacheManager.getDefaultCacheConfiguration();

    cacheManager.defineConfiguration(
        "wordcount",
        new ConfigurationBuilder()
            .read(dcc)
            .clustering()
            .l1()
            .disable()
            .clustering()
            .cacheMode(CacheMode.DIST_SYNC)
            .hash()
            .numOwners(1)
            .build());
    Cache<String, String> cache = cacheManager.getCache();

    Transport transport = cache.getAdvancedCache().getRpcManager().getTransport();
    if (isMaster)
      System.out.printf(
          "Node %s joined as master. View is %s.%n",
          transport.getAddress(), transport.getMembers());
    else
      System.out.printf(
          "Node %s joined as slave. View is %s.%n", transport.getAddress(), transport.getMembers());

    return cache;
  }
  public void testPreloadOnStart() throws CacheLoaderException {

    for (int i = 0; i < NUM_KEYS; i++) {
      c1.put("k" + i, "v" + i);
    }
    DataContainer dc1 = c1.getAdvancedCache().getDataContainer();
    assert dc1.size(null) == NUM_KEYS;

    DummyInMemoryCacheStore cs =
        (DummyInMemoryCacheStore)
            TestingUtil.extractComponent(c1, CacheLoaderManager.class).getCacheStore();
    assert cs.loadAllKeys(Collections.emptySet()).size() == NUM_KEYS;

    addClusterEnabledCacheManager();
    EmbeddedCacheManager cm2 = cacheManagers.get(1);
    cm2.defineConfiguration(cacheName, buildConfiguration());
    c2 = cache(1, cacheName);
    waitForClusterToForm();

    DataContainer dc2 = c2.getAdvancedCache().getDataContainer();
    assert dc2.size(null) == NUM_KEYS
        : "Expected all the cache store entries to be preloaded on the second cache";

    for (int i = 0; i < NUM_KEYS; i++) {
      assertOwnershipAndNonOwnership("k" + i, true);
    }
  }
 private Map<CacheCategory, CacheService> createCaches(CacheInfo cacheInfo) {
   Map<CacheCategory, CacheService> ciCaches = new HashMap<CacheCategory, CacheService>();
   for (Map.Entry<CacheCategory, CacheConfiguration> entry :
       cacheInfo.getConfiguration().entrySet()) {
     if (entry.getValue() instanceof InfinispanConfiguration) {
       CacheService cacheService;
       CacheCategory category = entry.getKey();
       InfinispanConfiguration config = (InfinispanConfiguration) entry.getValue();
       if (config.isCacheEnabled()) {
         String configurationName = config.getConfigurationName();
         if (null == configurationName) {
           Configuration dcc = manager.getDefaultCacheConfiguration();
           Configuration infinispan =
               config.getInfinispanConfiguration(new ConfigurationBuilder().read(dcc));
           configurationName = "$" + category.getName() + "$" + cacheInfo.getId();
           manager.defineConfiguration(configurationName, infinispan);
         }
         recorder.record("infinispan", "configuration name " + configurationName);
         cacheService =
             new InfinispanCacheService(manager.<String, Object>getCache(configurationName));
       } else {
         cacheService = noCacheFactory.create(null, category);
       }
       ciCaches.put(category, cacheService);
     }
   }
   return ciCaches;
 }
  private Configuration configureTransactionManager(
      Configuration regionOverrides, String templateCacheName, Properties properties) {
    // Get existing configuration to verify whether a tm was configured or not.
    Configuration templateConfig =
        manager.defineConfiguration(templateCacheName, new Configuration());
    String ispnTmLookupClassName = templateConfig.getTransactionManagerLookupClass();
    String hbTmLookupClassName =
        org.hibernate.cache.infinispan.tm.HibernateTransactionManagerLookup.class.getName();
    if (ispnTmLookupClassName != null && !ispnTmLookupClassName.equals(hbTmLookupClassName)) {
      log.debug(
          "Infinispan is configured ["
              + ispnTmLookupClassName
              + "] with a different transaction manager lookup "
              + "class than Hibernate ["
              + hbTmLookupClassName
              + "]");
    } else {
      regionOverrides.setTransactionManagerLookup(transactionManagerlookup);
    }

    String useSyncProp =
        ConfigurationHelper.extractPropertyValue(INFINISPAN_USE_SYNCHRONIZATION_PROP, properties);
    boolean useSync =
        useSyncProp == null ? DEF_USE_SYNCHRONIZATION : Boolean.parseBoolean(useSyncProp);
    regionOverrides.fluent().transaction().useSynchronization(useSync);

    return regionOverrides;
  }
  @BeforeMethod
  public void setUp() {
    cm = TestCacheManagerFactory.createLocalCacheManager();
    Configuration c = new Configuration();
    CacheLoaderManagerConfig clmc = new CacheLoaderManagerConfig();
    DummyInMemoryCacheStore.Cfg clc = new DummyInMemoryCacheStore.Cfg("no_passivation");
    clmc.addCacheLoaderConfig(clc);
    c.setCacheLoaderManagerConfig(clmc);
    cm.defineConfiguration("no_passivation", c);

    c = c.clone();
    ((DummyInMemoryCacheStore.Cfg) c.getCacheLoaderManagerConfig().getFirstCacheLoaderConfig())
        .setStoreName("passivation");
    c.getCacheLoaderManagerConfig().setPassivation(true);
    cm.defineConfiguration("passivation", c);
  }
 public void testDisabledInterceptorStack() {
   ConfigurationBuilder cfg = new ConfigurationBuilder();
   cfg.storeAsBinary().disable();
   cm.defineConfiguration("a", cfg.build());
   Cache<?, ?> c = cm.getCache("a");
   assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) == null;
 }
 private Cache getCache(String regionName, String typeKey, Properties properties) {
   TypeOverrides regionOverride = typeOverrides.get(regionName);
   if (!definedConfigurations.contains(regionName)) {
     String templateCacheName = null;
     Configuration regionCacheCfg = null;
     if (regionOverride != null) {
       if (log.isDebugEnabled())
         log.debug("Cache region specific configuration exists: " + regionOverride);
       regionOverride = overrideStatisticsIfPresent(regionOverride, properties);
       regionCacheCfg = regionOverride.createInfinispanConfiguration();
       String cacheName = regionOverride.getCacheName();
       if (cacheName != null) // Region specific override with a given cache name
       templateCacheName = cacheName;
       else // Region specific override without cache name, so template cache name is generic for
            // data type.
       templateCacheName = typeOverrides.get(typeKey).getCacheName();
     } else {
       // No region specific overrides, template cache name is generic for data type.
       templateCacheName = typeOverrides.get(typeKey).getCacheName();
       regionCacheCfg = typeOverrides.get(typeKey).createInfinispanConfiguration();
     }
     // Configure transaction manager
     regionCacheCfg = configureTransactionManager(regionCacheCfg, templateCacheName, properties);
     // Apply overrides
     manager.defineConfiguration(regionName, templateCacheName, regionCacheCfg);
     definedConfigurations.add(regionName);
   }
   Cache cache = manager.getCache(regionName);
   if (!cache.getStatus().allowInvocations()) {
     cache.start();
   }
   return createCacheWrapper(cache.getAdvancedCache());
 }
Ejemplo n.º 8
0
  private void doTest(boolean strict) {
    EmbeddedCacheManager cm1 = null, cm2 = null;
    try {
      Configuration c = new Configuration();
      c.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      GlobalConfiguration gc = GlobalConfiguration.getClusteredDefault();
      gc.setStrictPeerToPeer(strict);

      cm1 = TestCacheManagerFactory.createCacheManager(gc, c);
      cm2 = TestCacheManagerFactory.createCacheManager(gc, c);

      cm1.getCache();
      cm2.getCache();

      cm1.getCache().put("k", "v");
      assert "v".equals(cm1.getCache().get("k"));
      assert "v".equals(cm2.getCache().get("k"));

      cm1.defineConfiguration("newCache", c);

      if (strict) {
        try {
          cm1.getCache("newCache").put("k", "v");
          assert false : "Should have failed!";
        } catch (CacheException e) {
          assert e.getCause() instanceof NamedCacheNotFoundException;
        }
      } else {
        cm1.getCache("newCache").put("k", "v");
        assert "v".equals(cm1.getCache("newCache").get("k"));
      }
    } finally {
      TestingUtil.killCacheManagers(cm1, cm2);
    }
  }
 @Test
 public void testBuildDiffCacheNameTimestampsRegion() {
   final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
   Properties p = createProperties();
   p.setProperty("hibernate.cache.infinispan.timestamps.cfg", "unrecommended-timestamps");
   InfinispanRegionFactory factory = createRegionFactory(p);
   try {
     EmbeddedCacheManager manager = factory.getCacheManager();
     assertFalse(factory.getDefinedConfigurations().contains("timestamp"));
     assertTrue(factory.getDefinedConfigurations().contains("unrecommended-timestamps"));
     assertTrue(
         factory
             .getTypeOverrides()
             .get("timestamps")
             .getCacheName()
             .equals("unrecommended-timestamps"));
     ConfigurationBuilder builder = new ConfigurationBuilder();
     builder.clustering().stateTransfer().fetchInMemoryState(true);
     builder.clustering().cacheMode(CacheMode.REPL_SYNC);
     manager.defineConfiguration("unrecommended-timestamps", builder.build());
     TimestampsRegionImpl region =
         (TimestampsRegionImpl) factory.buildTimestampsRegion(timestamps, p);
     AdvancedCache cache = region.getCache();
     Configuration cacheCfg = cache.getCacheConfiguration();
     assertEquals(EvictionStrategy.NONE, cacheCfg.eviction().strategy());
     assertEquals(CacheMode.REPL_SYNC, cacheCfg.clustering().cacheMode());
     assertFalse(cacheCfg.storeAsBinary().enabled());
     assertFalse(cacheCfg.jmxStatistics().enabled());
   } finally {
     factory.stop();
   }
 }
Ejemplo n.º 10
0
 private HotRodServer addHotRodServer() {
   EmbeddedCacheManager cm = addClusterEnabledCacheManager(defaultBuilder);
   cm.defineConfiguration(DIST_ONE_CACHE_NAME, distOneBuilder.build());
   cm.defineConfiguration(DIST_TWO_CACHE_NAME, distTwoBuilder.build());
   HotRodServer server = HotRodClientTestingUtil.startHotRodServer(cm);
   addr2hrServer.put(new InetSocketAddress(server.getHost(), server.getPort()), server);
   return server;
 }
 private void defineGenericDataTypeCacheConfigurations(Settings settings, Properties properties)
     throws CacheException {
   String[] defaultGenericDataTypes =
       new String[] {ENTITY_KEY, COLLECTION_KEY, TIMESTAMPS_KEY, QUERY_KEY};
   for (String type : defaultGenericDataTypes) {
     TypeOverrides override = overrideStatisticsIfPresent(typeOverrides.get(type), properties);
     String cacheName = override.getCacheName();
     Configuration newCacheCfg = override.createInfinispanConfiguration();
     // Apply overrides
     Configuration cacheConfig = manager.defineConfiguration(cacheName, cacheName, newCacheCfg);
     // Configure transaction manager
     cacheConfig = configureTransactionManager(cacheConfig, cacheName, properties);
     manager.defineConfiguration(cacheName, cacheName, cacheConfig);
     definedConfigurations.add(cacheName);
     override.validateInfinispanConfiguration(cacheConfig);
   }
 }
 protected void testAddNewServer() throws Exception {
   EmbeddedCacheManager cm = addClusterEnabledCacheManager();
   cm.defineConfiguration(cacheName, configuration.build());
   Cache<Object, String> cache = cm.getCache(cacheName);
   caches.add(cache);
   waitForClusterToResize();
   assertUnaffected();
 }
Ejemplo n.º 13
0
 @Override
 protected EmbeddedCacheManager createCacheManager() throws Exception {
   // start a single cache instance
   ConfigurationBuilder c = getDefaultStandaloneCacheConfig(true);
   c.storeAsBinary().enable();
   EmbeddedCacheManager cm = TestCacheManagerFactory.createCacheManager(false);
   cm.defineConfiguration("lazy-cache-test", c.build());
   cache = cm.getCache("lazy-cache-test");
   return cm;
 }
  @Test
  public void testEnableStatistics() {
    Properties p = createProperties();
    p.setProperty("hibernate.cache.infinispan.statistics", "true");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.lifespan", "60000");
    p.setProperty("hibernate.cache.infinispan.com.acme.Person.expiration.max_idle", "30000");
    p.setProperty("hibernate.cache.infinispan.entity.cfg", "myentity-cache");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.strategy", "FIFO");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.wake_up_interval", "3000");
    p.setProperty("hibernate.cache.infinispan.entity.eviction.max_entries", "10000");
    InfinispanRegionFactory factory = createRegionFactory(p);
    try {
      EmbeddedCacheManager manager = factory.getCacheManager();
      assertTrue(manager.getCacheManagerConfiguration().globalJmxStatistics().enabled());
      EntityRegionImpl region =
          (EntityRegionImpl)
              factory.buildEntityRegion("com.acme.Address", p, MUTABLE_NON_VERSIONED);
      AdvancedCache cache = region.getCache();
      assertTrue(factory.getTypeOverrides().get("entity").isExposeStatistics());
      assertTrue(cache.getCacheConfiguration().jmxStatistics().enabled());

      region =
          (EntityRegionImpl) factory.buildEntityRegion("com.acme.Person", p, MUTABLE_NON_VERSIONED);
      cache = region.getCache();
      assertTrue(factory.getTypeOverrides().get("com.acme.Person").isExposeStatistics());
      assertTrue(cache.getCacheConfiguration().jmxStatistics().enabled());

      final String query = "org.hibernate.cache.internal.StandardQueryCache";
      QueryResultsRegionImpl queryRegion =
          (QueryResultsRegionImpl) factory.buildQueryResultsRegion(query, p);
      cache = queryRegion.getCache();
      assertTrue(factory.getTypeOverrides().get("query").isExposeStatistics());
      assertTrue(cache.getCacheConfiguration().jmxStatistics().enabled());

      final String timestamps = "org.hibernate.cache.spi.UpdateTimestampsCache";
      ConfigurationBuilder builder = new ConfigurationBuilder();
      builder.clustering().stateTransfer().fetchInMemoryState(true);
      manager.defineConfiguration("timestamps", builder.build());
      TimestampsRegionImpl timestampsRegion =
          (TimestampsRegionImpl) factory.buildTimestampsRegion(timestamps, p);
      cache = timestampsRegion.getCache();
      assertTrue(factory.getTypeOverrides().get("timestamps").isExposeStatistics());
      assertTrue(cache.getCacheConfiguration().jmxStatistics().enabled());

      CollectionRegionImpl collectionRegion =
          (CollectionRegionImpl)
              factory.buildCollectionRegion("com.acme.Person.addresses", p, MUTABLE_NON_VERSIONED);
      cache = collectionRegion.getCache();
      assertTrue(factory.getTypeOverrides().get("collection").isExposeStatistics());
      assertTrue(cache.getCacheConfiguration().jmxStatistics().enabled());
    } finally {
      factory.stop();
    }
  }
  public void testDefaultInterceptorStack() {
    assert TestingUtil.findInterceptor(cm.getCache(), MarshalledValueInterceptor.class) == null;

    ConfigurationBuilder configuration = new ConfigurationBuilder();
    configuration.storeAsBinary().enable();
    cm.defineConfiguration("someCache", configuration.build());
    Cache<?, ?> c = cm.getCache("someCache");

    assert TestingUtil.findInterceptor(c, MarshalledValueInterceptor.class) != null;
    TestingUtil.killCaches(c);
  }
  protected CacheContainer createCacheManager(String tmpDirectory) {
    // increment the DIMCS store id
    FileCacheStoreConfig cfg = new FileCacheStoreConfig();
    cfg.setLocation(tmpDirectory);
    cfg.setPurgeSynchronously(true); // for more accurate unit testing
    cfg.setFetchPersistentState(true);

    CacheLoaderManagerConfig clmc = new CacheLoaderManagerConfig();
    clmc.addCacheLoaderConfig(cfg);
    clmc.setShared(sharedCacheLoader.get());
    config.setCacheLoaderManagerConfig(clmc);

    EmbeddedCacheManager cm = addClusterEnabledCacheManager();
    cm.defineConfiguration(cacheName, config.clone());
    return cm;
  }
Ejemplo n.º 17
0
  public static EmbeddedCacheManager startInfinispan() {
    // Cache<Object, Object> cache = new DefaultCacheManager().getCache();
    EmbeddedCacheManager manager = new DefaultCacheManager();

    Configuration conf = new Configuration();
    conf.setCacheMode(CacheMode.LOCAL);

    manager.defineConfiguration("custom-cache", conf);

    Cache<String, Object> cache;
    cache = manager.getCache("custom-cache");
    simpleCacheTest(cache);

    cache = CacheFactory.getCache();
    simpleCacheTest(cache);
    cache.clear();
    return manager;
  }
Ejemplo n.º 18
0
  @BeforeClass
  public static void beforeclass() {
    GlobalConfigurationBuilder globalConfigurationBuilder =
        new GlobalConfigurationBuilder().nonClusteredDefault();
    globalConfigurationBuilder.globalJmxStatistics().jmxDomain("infinispan-" + UUID.randomUUID());

    ConfigurationBuilder cacheConfiguration = new ConfigurationBuilder();
    cacheConfiguration.dataContainer().keyEquivalence(new AnyServerEquivalence());

    serverCache = new DefaultCacheManager(globalConfigurationBuilder.build());
    serverCache.defineConfiguration("sessions", cacheConfiguration.build());

    HotRodServerConfigurationBuilder hotRodServerConfigurationBuilder =
        new HotRodServerConfigurationBuilder();
    hotRodServerConfigurationBuilder.port(RemoteConfiguration.SERVER_PORT);

    server = new HotRodServer();
    server.start(hotRodServerConfigurationBuilder.build(), serverCache);
  }
  public void testPreloading() throws CacheLoaderException {
    Configuration preloadingCfg = cfg.clone();
    preloadingCfg.getCacheLoaderManagerConfig().setPreload(true);
    ((DummyInMemoryCacheStore.Cfg)
            preloadingCfg.getCacheLoaderManagerConfig().getFirstCacheLoaderConfig())
        .setStoreName("preloadingCache");
    cm.defineConfiguration("preloadingCache", preloadingCfg);
    Cache preloadingCache = cm.getCache("preloadingCache");
    CacheStore preloadingStore =
        TestingUtil.extractComponent(preloadingCache, CacheLoaderManager.class).getCacheStore();

    assert preloadingCache.getConfiguration().getCacheLoaderManagerConfig().isPreload();

    assertNotInCacheAndStore(preloadingCache, preloadingStore, "k1", "k2", "k3", "k4");

    preloadingCache.put("k1", "v1");
    preloadingCache.put("k2", "v2", lifespan, MILLISECONDS);
    preloadingCache.put("k3", "v3");
    preloadingCache.put("k4", "v4", lifespan, MILLISECONDS);

    for (int i = 1; i < 5; i++) {
      if (i % 2 == 1) assertInCacheAndStore(preloadingCache, preloadingStore, "k" + i, "v" + i);
      else assertInCacheAndStore(preloadingCache, preloadingStore, "k" + i, "v" + i, lifespan);
    }

    DataContainer c = preloadingCache.getAdvancedCache().getDataContainer();
    assert c.size(null) == 4;
    preloadingCache.stop();
    assert c.size(null) == 0;

    preloadingCache.start();
    assert preloadingCache.getConfiguration().getCacheLoaderManagerConfig().isPreload();
    c = preloadingCache.getAdvancedCache().getDataContainer();
    assert c.size(null) == 4;

    for (int i = 1; i < 5; i++) {
      if (i % 2 == 1) assertInCacheAndStore(preloadingCache, preloadingStore, "k" + i, "v" + i);
      else assertInCacheAndStore(preloadingCache, preloadingStore, "k" + i, "v" + i, lifespan);
    }
  }
Ejemplo n.º 20
0
  @Override
  protected void createCacheManagers() {
    cm0 = addClusterEnabledCacheManager();
    cm1 = addClusterEnabledCacheManager();
    cm2 = addClusterEnabledCacheManager();

    ConfigurationBuilder conf = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC);
    cm0.defineConfiguration("pushing", addDummyStore(conf, true).build());
    cm1.defineConfiguration("pushing", addDummyStore(conf, true).build());
    cm2.defineConfiguration("pushing", addDummyStore(conf, true).build());

    conf = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC);
    // cannot define on ALL cache managers since the same dummy in memory CL bin will be used!
    cm0.defineConfiguration("nonPushing", addDummyStore(conf, false).build());
    cm1.defineConfiguration("nonPushing", addDummyStore(conf, false).build());
    cm2.defineConfiguration("nonPushing", addDummyStore(conf, false).build());
  }
 protected EmbeddedCacheManager createCacheManager() {
   EmbeddedCacheManager cm = addClusterEnabledCacheManager();
   cm.defineConfiguration(TX_CACHE, buildConfiguration(true));
   cm.defineConfiguration(NONTX_CACHE, buildConfiguration(true));
   return cm;
 }
  protected void initEmbedded() {
    GlobalConfigurationBuilder gcb = new GlobalConfigurationBuilder();

    boolean clustered = config.getBoolean("clustered", false);
    boolean async = config.getBoolean("async", true);
    boolean allowDuplicateJMXDomains = config.getBoolean("allowDuplicateJMXDomains", true);

    if (clustered) {
      gcb.transport().defaultTransport();
    }
    gcb.globalJmxStatistics().allowDuplicateDomains(allowDuplicateJMXDomains);

    cacheManager = new DefaultCacheManager(gcb.build());
    containerManaged = false;

    logger.debug("Started embedded Infinispan cache container");

    ConfigurationBuilder invalidationConfigBuilder = new ConfigurationBuilder();
    if (clustered) {
      invalidationConfigBuilder
          .clustering()
          .cacheMode(async ? CacheMode.INVALIDATION_ASYNC : CacheMode.INVALIDATION_SYNC);
    }
    Configuration invalidationCacheConfiguration = invalidationConfigBuilder.build();

    cacheManager.defineConfiguration(
        InfinispanConnectionProvider.REALM_CACHE_NAME, invalidationCacheConfiguration);
    cacheManager.defineConfiguration(
        InfinispanConnectionProvider.USER_CACHE_NAME, invalidationCacheConfiguration);

    ConfigurationBuilder sessionConfigBuilder = new ConfigurationBuilder();
    if (clustered) {
      String sessionsMode = config.get("sessionsMode", "distributed");
      if (sessionsMode.equalsIgnoreCase("replicated")) {
        sessionConfigBuilder
            .clustering()
            .cacheMode(async ? CacheMode.REPL_ASYNC : CacheMode.REPL_SYNC);
      } else if (sessionsMode.equalsIgnoreCase("distributed")) {
        sessionConfigBuilder
            .clustering()
            .cacheMode(async ? CacheMode.DIST_ASYNC : CacheMode.DIST_SYNC);
      } else {
        throw new RuntimeException("Invalid value for sessionsMode");
      }

      sessionConfigBuilder
          .clustering()
          .hash()
          .numOwners(config.getInt("sessionsOwners", 2))
          .numSegments(config.getInt("sessionsSegments", 60))
          .build();
    }

    Configuration sessionCacheConfiguration = sessionConfigBuilder.build();
    cacheManager.defineConfiguration(
        InfinispanConnectionProvider.SESSION_CACHE_NAME, sessionCacheConfiguration);
    cacheManager.defineConfiguration(
        InfinispanConnectionProvider.OFFLINE_SESSION_CACHE_NAME, sessionCacheConfiguration);
    cacheManager.defineConfiguration(
        InfinispanConnectionProvider.LOGIN_FAILURE_CACHE_NAME, sessionCacheConfiguration);

    ConfigurationBuilder replicationConfigBuilder = new ConfigurationBuilder();
    if (clustered) {
      replicationConfigBuilder
          .clustering()
          .cacheMode(async ? CacheMode.REPL_ASYNC : CacheMode.REPL_SYNC);
    }
    Configuration replicationCacheConfiguration = replicationConfigBuilder.build();
    cacheManager.defineConfiguration(
        InfinispanConnectionProvider.WORK_CACHE_NAME, replicationCacheConfiguration);

    ConfigurationBuilder counterConfigBuilder = new ConfigurationBuilder();
    counterConfigBuilder
        .invocationBatching()
        .enable()
        .transaction()
        .transactionMode(TransactionMode.TRANSACTIONAL);
    counterConfigBuilder
        .transaction()
        .transactionManagerLookup(new DummyTransactionManagerLookup());
    counterConfigBuilder.transaction().lockingMode(LockingMode.PESSIMISTIC);
    Configuration counterCacheConfiguration = counterConfigBuilder.build();

    cacheManager.defineConfiguration(
        InfinispanConnectionProvider.VERSION_CACHE_NAME, counterCacheConfiguration);
  }