Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-4983

Public API for tracking completion of Infinispan work for a given user transaction



      When using Infinispan with user transactions, Infinispan will persist the changes to the cache store using a synchronization on the user transaction. This means the persistence operation begins when the user transaction has committed. However, components using Infinispan will likely want to know when Infinispan's work has completed for a given transaction.

      In Infinispan 6, it was possible to do this by registering a transaction listener:

      org.infinispan.Cache cache = ...
      javax.transaction.Transaction activeTransaction = ...
      org.infinispan.transaction.TransactionTable txnTable = cache.getAdvancedCache().getComponentRegistry().getComponent(TransactionTable.class);
      org.infinispan.transaction.xa.GlobalTransaction ispnTxID = txnTable.getLocalTransaction(activeTransaction).getGlobalTransaction();

      We'd then use the GlobalTransaction in our @Listener:

      class TxnListener {
          public void transactionCompleted( TransactionCompletedEvent event ) {
              if ( !event.isOriginLocal() ) return;
              GlobalTransaction eventIspnTransaction = event.getGlobalTransaction();
              if (eventIspnTransaction == null || 
                 ispnTxID.getId() != eventIspnTransaction.getId()) return;
              if ( !event.isSuccessful() ) {
                  // do stuff
              } else {
                  // do other stuff

      However, this is no longer possible in Infinispan 7 since these classes were moved to an "impl" package.

      Can we please have a public API to be notified when Infinispan has complete its work for a specific user transaction? It doesn't have to be like it was in 6, but ModeShape needs something (see MODE-2353 for details).

        Gliffy Diagrams


            Issue Links



                • Assignee:
                  pruivo Pedro Ruivo
                  rhauch Randall Hauch
                • Votes:
                  0 Vote for this issue
                  1 Start watching this issue


                  • Created: