Package org.infinispan.context

Examples of org.infinispan.context.TransactionContext


   }

   @Override
   public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable {
      Object retVal = invokeNextInterceptor(ctx, command);
      TransactionContext transactionContext = ctx.getTransactionContext();
      if (transactionContext.hasLocalModifications()) {
         PrepareCommand replicablePrepareCommand = command.copy(); // make sure we remove any "local" transactions
         replicablePrepareCommand.removeModifications(transactionContext.getLocalModifications());
         command = replicablePrepareCommand;
      }

      if (!skipReplicationOfTransactionMethod(ctx)) runPreparePhase(command, command.getGlobalTransaction(), ctx);
      return retVal;
View Full Code Here


      else if (ctx.hasFlag(Flag.FORCE_SYNCHRONOUS)) sync = true;

      // tx-level overrides are more important
      Transaction tx = ctx.getTransaction();
      if (tx != null) {
         TransactionContext transactionContext = ctx.getTransactionContext();
         if (transactionContext != null) {
            if (transactionContext.isForceAsyncReplication()) sync = false;
            else if (transactionContext.isForceSyncReplication()) sync = true;
         }
      }

      replicateCall(recipients, c, sync, useOutOfBandMessage, syncReplTimeout);
   }
View Full Code Here

      Transaction tx = ctx.getTransaction();
      if (tx != null) {
         if (trace) log.trace("Entering InvalidationInterceptor's prepare phase");
         // fetch the modifications before the transaction is committed (and thus removed from the txTable)
         GlobalTransaction gtx = ctx.getGlobalTransaction();
         TransactionContext transactionContext = ctx.getTransactionContext();
         if (transactionContext == null)
            throw new IllegalStateException("cannot find transaction transactionContext for " + gtx);

         if (transactionContext.hasModifications()) {
            List<WriteCommand> mods;
            if (transactionContext.hasLocalModifications()) {
               mods = Arrays.asList(command.getModifications());
               mods.removeAll(transactionContext.getLocalModifications());
            } else {
               mods = Arrays.asList(command.getModifications());
            }
            broadcastInvalidate(mods, tx, ctx);
         } else {
View Full Code Here

      return gtx != null && (gtx.getAddress() != null) && (!gtx.getAddress().equals(rpcManager.getTransport().getAddress()));
   }

   private void copyInvocationScopeFlagsToTxScope(InvocationContext ctx) {
      // notify the transaction tCtx that this override is in place.
      TransactionContext tCtx = ctx.getTransactionContext();
      if (tCtx != null) {
         if (ctx.hasFlag(Flag.CACHE_MODE_LOCAL)) tCtx.setFlags(Flag.CACHE_MODE_LOCAL);
         if (ctx.hasFlag(Flag.SKIP_CACHE_STATUS_CHECK)) tCtx.setFlags(Flag.SKIP_CACHE_STATUS_CHECK);
      }
   }
View Full Code Here

      // Is there a local transaction associated with GTX?  (not the current tx associated with the thread, which may be
      // in the invocation context
      Transaction ltx = txTable.getLocalTransaction(gtx);
      Transaction currentTx = txManager.getTransaction();
      TransactionContext transactionContext;
      Object retval = null;
      boolean success = false;
      try {
         if (ltx == null) {
            if (currentTx != null) txManager.suspend();
View Full Code Here

            throw new RuntimeException("Commit failed.", e);
      }
   }

   protected void cleanupStaleLocks(InvocationContext ctx) throws Throwable {
      TransactionContext transactionContext = ctx.getTransactionContext();
      if (transactionContext != null) lockManager.unlock(ctx);
   }
View Full Code Here

      GlobalTransaction gtx;

      if (transactions.add(tx)) {
         gtx = txTable.getCurrentTransaction(tx, true);
         TransactionContext transactionContext;
         if (ctx.getGlobalTransaction() == null) {
            ctx.setGlobalTransaction(gtx);
            transactionContext = txTable.getTransactionContext(gtx);
            ctx.setTransactionContext(transactionContext);
         } else {
View Full Code Here

   }

   @Override
   public Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command) throws Throwable {
      Object retVal = invokeNextInterceptor(ctx, command);
      TransactionContext transactionContext = ctx.getTransactionContext();
      if (transactionContext.hasLocalModifications()) {
         PrepareCommand replicablePrepareCommand = command.copy(); // make sure we remove any "local" transactions
         replicablePrepareCommand.removeModifications(transactionContext.getLocalModifications());
         command = replicablePrepareCommand;
      }

      if (!skipReplicationOfTransactionMethod(ctx)) {
         boolean sync = configuration.getCacheMode().isSynchronous();
View Full Code Here

    * Returns the global transaction associated with the local transaction. Returns null if tx is null or it was not
    * found.
    */
   public GlobalTransaction get(Transaction tx) {
      if (tx == null) return null;
      TransactionContext ctx = txMapping.get(tx);
      return ctx == null ? null : ctx.getGobalTransaction();
   }
View Full Code Here

      txMapping.put(tx, ctx);
      gtxMapping.put(gtx, ctx);
   }

   public Transaction getLocalTransaction(GlobalTransaction gtx) {
      TransactionContext ctx = gtxMapping.get(gtx);
      return ctx == null ? null : ctx.getTransaction();
   }
View Full Code Here

TOP

Related Classes of org.infinispan.context.TransactionContext

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.