public LocalTransaction getOrCreateLocalTransaction(Transaction transaction, boolean implicitTransaction, Supplier<GlobalTransaction> gtxFactory) {
      LocalTransaction current = localTransactions.get(transaction);
      if (current == null) {
         if (!running) {
            // Assume that we wouldn't get this far if the cache was already stopped
            throw log.cacheIsStopping(cacheName);
         }
         GlobalTransaction tx = gtxFactory.get();
         current = txFactory.newLocalTransaction(transaction, tx, implicitTransaction, currentTopologyId);
         if (trace) log.tracef("Created a new local transaction: %s", current);
         localTransactions.put(transaction, current);
         globalToLocalTransactions.put(current.getGlobalTransaction(), current);
         if (notifier.hasListener(TransactionRegistered.class)) {
            // TODO: this should be allowed to be async at some point
            CompletionStages.join(notifier.notifyTransactionRegistered(tx, true));
         }
      }
      return current;
   }
public LocalTransaction getOrCreateLocalTransaction ( Transaction transaction , boolean implicitTransaction , Supplier < GlobalTransaction > gtxFactory ) { LocalTransaction current = localTransactions . get ( transaction ) ; if ( current == null ) { if ( ! running ) { throw log . cacheIsStopping ( cacheName ) ; } GlobalTransaction tx = gtxFactory . get ( ) ; current = txFactory . newLocalTransaction ( transaction , tx , implicitTransaction , currentTopologyId ) ; if ( trace ) log . tracef ( "Created a new local transaction: %s" , current ) ; localTransactions . put ( transaction , current ) ; globalToLocalTransactions . put ( current . getGlobalTransaction ( ) , current ) ; if ( notifier . hasListener ( TransactionRegistered . class ) ) { CompletionStages . join ( notifier . notifyTransactionRegistered ( tx , true ) ) ; } } return current ; }
Similar to {@link #getOrCreateLocalTransaction(Transaction, boolean)} but with a custom global transaction factory.