1 Reply Latest reply on Feb 10, 2016 9:18 PM by Bill Burke

    lock() unsupported with a wildfly subsystem created cache

    Bill Burke Master

      What am I doing wrong?

       

      I have the following in standalone.xml

       

                  <local-cache name="realmVersions">
                      <transaction mode="BATCH" locking="PESSIMISTIC"/>
                  </local-cache>

       

       

      My cache is throwing an exception when invoking cache.getAdvancedCache().lock()

       

      Caused by: java.lang.UnsupportedOperationException: Calling lock() on non-transactional caches is not allowed

              at org.infinispan.cache.impl.CacheImpl.lock(CacheImpl.java:820)

       

      Here's my embedded config which works:

       

          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(VERSION_CACHE_NAME, counterCacheConfiguration);