2 Replies Latest reply on Jun 4, 2018 9:54 PM by Paul Ferraro

    How to configure and use pessimistic lock in Wildfly10/EAP7 cluster?

    Patrick Huang Newbie

      Hi guys,


      I am trying to configure infinispan cache to use it as a cluster lock. Here is my config:

      <cache-container name="mt-cluster-cache">

                      <transport lock-timeout="60000"/>

                      <distributed-cache name="doc-lock" jndi-name="infinispan/mt-cluster-cache/doc-lock" mode="SYNC" owners="2">

                          <transaction locking="PESSIMISTIC" mode="FULL_XA"/>




      I am using CDI so here is how I produce the cache:

      @Resource(lookup = "java:jboss/infinispan/container/mt-cluster-cache")

      private CacheContainer mtClusterCache;



      public Cache<DocumentProcessKey, Boolean> docProcessCache() {

         return mtClusterCache.getCache(DOC_PROCESS_CACHE);




      public TransactionManager dockProcessCacheTransactionManager(


        Cache<DocumentProcessKey, Boolean> cache) {

         return cache.getAdvancedCache().getTransactionManager();



      However when I try to use it the transaction manager is null.


      // transaction.begin();


      If I inject UserTransaction from the Wildfly/EAP container and use that instead, it will complain locking requires transaction etc. What did I do wrong here? Thanks.