Package org.infinispan.transaction.xa

Examples of org.infinispan.transaction.xa.LocalTransaction


      return enlistReadAndInvokeNext(ctx, command);
   }

   private Object enlistReadAndInvokeNext(InvocationContext ctx, VisitableCommand command) throws Throwable {
      if (shouldEnlist(ctx)) {
         LocalTransaction localTransaction = enlist(ctx);
         LocalTxInvocationContext localTxContext = (LocalTxInvocationContext) ctx;
         localTxContext.setLocalTransaction(localTransaction);
      }
      return invokeNextInterceptor(ctx, command);
   }
View Full Code Here


      }
      return invokeNextInterceptor(ctx, command);
   }

   private Object enlistWriteAndInvokeNext(InvocationContext ctx, WriteCommand command) throws Throwable {
      LocalTransaction localTransaction = null;
      boolean shouldAddMod = false;
      if (shouldEnlist(ctx)) {
         localTransaction = enlist(ctx);
         LocalTxInvocationContext localTxContext = (LocalTxInvocationContext) ctx;
         if (localModeNotForced(ctx)) shouldAddMod = true;
         localTxContext.setLocalTransaction(localTransaction);
      }
      Object rv;
      rv = invokeNextInterceptor(ctx, command);
      if (!ctx.isInTxScope())
         transactionLog.logNoTxWrite(command);
      if (command.isSuccessful() && shouldAddMod) localTransaction.addModification(command);
      return rv;
   }
View Full Code Here

      Transaction transaction = tm.getTransaction();
      if (transaction == null) throw new IllegalStateException("This should only be called in an tx scope");
      int status = transaction.getStatus();
      if (isNotValid(status)) throw new IllegalStateException("Transaction " + transaction +
            " is not in a valid state to be invoking cache operations on.");
      LocalTransaction localTransaction = txTable.getOrCreateLocalTransaction(transaction, ctx);
      if (!localTransaction.isEnlisted()) { //make sure that you only enlist it once
         try {
            transaction.enlistResource(new TransactionXaAdapter(localTransaction, txTable, commandsFactory, configuration, invoker, icc));
         } catch (Exception e) {
            log.error("Failed to enlist TransactionXaAdapter to transaction");
            throw new CacheException(e);
View Full Code Here

            localContext = new LocalTxInvocationContext();
            icTl.set(localContext);
         } else {
            localContext = (LocalTxInvocationContext) existing;
         }
         LocalTransaction localTransaction = transactionTable.getLocalTransaction(tx);
         localContext.setLocalTransaction(localTransaction);
         return localContext;
      } else {
         NonTxInvocationContext nonTxContext;
         if ((existing == null) || !(existing instanceof NonTxInvocationContext)) {
View Full Code Here

            localContext = new LocalTxInvocationContext();
            icTl.set(localContext);
         } else {
            localContext = (LocalTxInvocationContext) existing;
         }
         LocalTransaction localTransaction = transactionTable.getLocalTransaction(tx);
         localContext.setLocalTransaction(localTransaction);
         return localContext;
      } else {
         NonTxInvocationContext nonTxContext;
         if ((existing == null) || !(existing instanceof NonTxInvocationContext)) {
View Full Code Here

      return enlistReadAndInvokeNext(ctx, command);
   }

   private Object enlistReadAndInvokeNext(InvocationContext ctx, VisitableCommand command) throws Throwable {
      if (shouldEnlist(ctx)) {
         LocalTransaction localTransaction = enlist(ctx);
         LocalTxInvocationContext localTxContext = (LocalTxInvocationContext) ctx;
         localTxContext.setLocalTransaction(localTransaction);
      }
      return invokeNextInterceptor(ctx, command);
   }
View Full Code Here

      }
      return invokeNextInterceptor(ctx, command);
   }

   private Object enlistWriteAndInvokeNext(InvocationContext ctx, WriteCommand command) throws Throwable {
      LocalTransaction localTransaction = null;
      boolean shouldAddMod = false;
      if (shouldEnlist(ctx)) {
         localTransaction = enlist(ctx);
         LocalTxInvocationContext localTxContext = (LocalTxInvocationContext) ctx;
         if (localModeNotForced(ctx)) shouldAddMod = true;
         localTxContext.setLocalTransaction(localTransaction);
      }
      Object rv;
      rv = invokeNextInterceptor(ctx, command);
      if (!ctx.isInTxScope())
         transactionLog.logNoTxWrite(command);
      if (command.isSuccessful() && shouldAddMod) localTransaction.addModification(command);
      return rv;
   }
View Full Code Here

      Transaction transaction = tm.getTransaction();
      if (transaction == null) throw new IllegalStateException("This should only be called in an tx scope");
      int status = transaction.getStatus();
      if (isNotValid(status)) throw new IllegalStateException("Transaction " + transaction +
            " is not in a valid state to be invoking cache operations on.");
      LocalTransaction localTransaction = txTable.getOrCreateLocalTransaction(transaction, ctx);
      if (!localTransaction.isEnlisted()) { //make sure that you only enlist it once
         try {
            transaction.enlistResource(new TransactionXaAdapter(localTransaction, txTable, commandsFactory, configuration, invoker, icc));
         } catch (Exception e) {
            Xid xid = localTransaction.getXid();
            if (xid != null && !ctx.getLockedKeys().isEmpty()) {
               log.debug("Attempting a rollback to clear stale resources!");
               try {
                  TransactionXaAdapter.rollbackImpl(xid, commandsFactory, icc, invoker, txTable);
               } catch (XAException xae) {
View Full Code Here

            localContext = new LocalTxInvocationContext();
            icTl.set(localContext);
         } else {
            localContext = (LocalTxInvocationContext) existing;
         }
         LocalTransaction localTransaction = transactionTable.getLocalTransaction(tx);
         localContext.setLocalTransaction(localTransaction);
         localContext.setTransaction(tx);
         return localContext;
      } else {
         NonTxInvocationContext nonTxContext;
View Full Code Here

      return enlistReadAndInvokeNext(ctx, command);
   }

   private Object enlistReadAndInvokeNext(InvocationContext ctx, VisitableCommand command) throws Throwable {
      if (shouldEnlist(ctx)) {
         LocalTransaction localTransaction = enlist(ctx);
         LocalTxInvocationContext localTxContext = (LocalTxInvocationContext) ctx;
         localTxContext.setLocalTransaction(localTransaction);
      }
      return invokeNextInterceptor(ctx, command);
   }
View Full Code Here

TOP

Related Classes of org.infinispan.transaction.xa.LocalTransaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.