Package org.infinispan.transaction

Examples of org.infinispan.transaction.GlobalTransaction


      Object retval = invokeNextInterceptor(ctx, command);
      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()) {
View Full Code Here


      if (trace) log.trace("Invoked with command " + command + " and InvocationContext [" + ctx + "]");

      try {
         if (txManager != null) {
            Transaction tx = getTransaction();
            GlobalTransaction realGtx = getGlobalTransaction(tx, gtx);
            if (tx == null && realGtx != null && realGtx.isRemote()) tx = txTable.getLocalTransaction(gtx);
            setTransactionalContext(tx, realGtx, null, ctx);
         } else {
            setTransactionalContext(null, null, null, ctx);
         }
View Full Code Here

    *    - there is no transaction. Why broadcast a commit or rollback if there is no transaction going on?
    *    - the current transaction did not modify any data
    * </pre>
    */
   protected final boolean skipReplicationOfTransactionMethod(InvocationContext ctx) {
      GlobalTransaction gtx = ctx.getGlobalTransaction();
      return ctx.getTransaction() == null || gtx == null || gtx.isRemote() || ctx.hasFlag(Flag.CACHE_MODE_LOCAL)
            || !ctx.getTransactionContext().hasModifications();
   }
View Full Code Here

   /**
    * The call runs in a transaction and it was initiated on this cache instance of the cluster.
    */
   protected final boolean isTransactionalAndLocal(InvocationContext ctx) {
      GlobalTransaction gtx = ctx.getGlobalTransaction();
      boolean isInitiatedHere = gtx != null && !gtx.isRemote();
      return isInitiatedHere && (ctx.getTransaction() != null);
   }
View Full Code Here

         if (trace) log.trace("received my own message (discarding it)");
         return null;
      }
      try {
         if (trace) log.trace("(" + cacheManager.getAddress() + ") call on command [" + command + "]");
         GlobalTransaction gtx = ctx.getGlobalTransaction();
         Transaction ltx = txTable.getLocalTransaction(gtx, true);
         // disconnect if we have a current tx associated
         Transaction currentTx = txManager.getTransaction();
         boolean resumeCurrentTxOnCompletion = false;
         try {
View Full Code Here

         if (trace) log.trace("received my own message (discarding it)");
         return null;
      }
      try {
         if (trace) log.trace("(" + cacheManager.getAddress() + ") call on command [" + command + "]");
         GlobalTransaction gtx = ctx.getGlobalTransaction();
         Transaction ltx = txTable.getLocalTransaction(gtx);
         if (ltx == null) {
            log.warn("No local transaction for this remotely originating rollback.  Possibly rolling back before a prepare call was broadcast?");
            txTable.cleanup(gtx);
            return null;
View Full Code Here

    * @return result of the prepare, typically a null.
    * @throws Throwable in the event of problems.
    */
   private Object handleRemotePrepare(InvocationContext ctx, PrepareCommand command) throws Throwable {
      // the InvocationContextInterceptor would have set this for us
      GlobalTransaction gtx = ctx.getGlobalTransaction();

      // 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();
View Full Code Here

   private ReplicableCommand attachGlobalTransaction(InvocationContext ctx, Transaction tx, VisitableCommand command) throws Throwable {
      if (trace) {
         log.trace(" local transaction exists - registering global tx if not present for " + Thread.currentThread());
      }
      if (trace) {
         GlobalTransaction tempGtx = txTable.get(tx);
         log.trace("Associated gtx in txTable is " + tempGtx);
      }

      // register a sync handler for this tx - only if the globalTransaction is not remotely initiated.
      GlobalTransaction gtx = registerTransaction(tx, ctx);
      if (gtx == null) {
         // get the current globalTransaction from the txTable.
         gtx = txTable.get(tx);
      }
View Full Code Here

    * passes the meth call up the interceptor chain.
    *
    * @throws Throwable
    */
   private Object handleCommitRollback(InvocationContext ctx, VisitableCommand command) throws Throwable {
      GlobalTransaction gtx = ctx.getGlobalTransaction();
      Object result;
      result = invokeNextInterceptor(ctx, command);
      if (log.isDebugEnabled()) log.debug("Finished local commit/rollback method for " + gtx);
      return result;
   }
View Full Code Here

      // transaction is in a valid state before moving on, and throwing an exception if not.
      boolean txValid = TransactionTable.isValid(tx);
      if (!txValid)
         throw new IllegalStateException("Transaction " + tx + " is not in a valid state to be invoking cache operations on.");

      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 {
            transactionContext = ctx.getTransactionContext();
         }
         if (gtx.isRemote()) {
            // should be no need to register a handler since this a remotely initiated globalTransaction
            if (trace) log.trace("is a remotely initiated gtx so no need to register a tx for it");
         } else {
            if (trace) log.trace("Registering sync handler for tx {0} and gtx {1}", tx, gtx);
View Full Code Here

TOP

Related Classes of org.infinispan.transaction.GlobalTransaction

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.