Package org.jboss.cache.transaction

Examples of org.jboss.cache.transaction.TransactionEntry


   }


   private void cleanupStaleLocks(GlobalTransaction gtx) throws Throwable
   {
      TransactionEntry entry = txTable.get(gtx);
      if (entry != null)
      {
         entry.releaseAllLocksLIFO(gtx);
      }
   }
View Full Code Here


      if (tx != null && !optimistic)
      {
         log.debug("Entering InvalidationInterceptor's prepare phase");
         // fetch the modifications before the transaction is committed (and thus removed from the txTable)
         gtx = ctx.getGlobalTransaction();
         TransactionEntry entry = txTable.get(gtx);
         if (entry == null) throw new IllegalStateException("cannot find transaction entry for " + gtx);
         List<MethodCall> modifications = new LinkedList<MethodCall>(entry.getModifications());
         if (modifications.size() > 0)
         {
            broadcastInvalidate(modifications, gtx, tx, ctx);
         }
         else
View Full Code Here

      Transaction tx = ctx.getTransaction();
      if (tx != null)
      {
         // here we just record the modifications but actually do the invalidate in commit.
         gtx = ctx.getGlobalTransaction();
         TransactionEntry entry = txTable.get(gtx);
         if (entry == null) throw new IllegalStateException("cannot find transaction entry for " + gtx);
         modifications = new LinkedList<MethodCall>(entry.getModifications());
         if (modifications.size() > 0)
         {
            txMods.put(gtx, modifications);
         }
      }
View Full Code Here

      if (trace) log.trace("Broadcasting call " + call + " to recipient list " + recipients);
      Transaction tx = ctx.getTransaction();
      if (tx != null)
      {
         GlobalTransaction gtx = ctx.getGlobalTransaction();
         TransactionEntry te = cache.getTransactionTable().get(gtx);
         if (te != null)
         {
            if (te.isForceAsyncReplication()) sync = false;
            else if (te.isForceSyncReplication()) sync = true;
         }
      }
      if (!sync && replicationQueue != null && !usingBuddyReplication)
      {
         putCallOnAsyncReplicationQueue(call);
View Full Code Here

         timeout = ctx.getOptionOverrides().getLockAcquisitionTimeout();
      }
      try
      {
         TransactionWorkspace<?, ?> workspace = getTransactionWorkspace(gtx);
         TransactionEntry te = cache.getTransactionTable().get(gtx);
         if (log.isDebugEnabled()) log.debug("Locking nodes in transaction workspace for GlobalTransaction " + gtx);

         for (WorkspaceNode workspaceNode : workspace.getNodes().values())
         {
            NodeSPI node = workspaceNode.getNode();

            boolean isWriteLockNeeded = workspaceNode.isDirty() || (workspaceNode.isChildrenModified() && (configuration.isLockParentForChildInsertRemove() || node.isLockForChildInsertRemove()));

            boolean acquired = node.getLock().acquire(gtx, timeout, isWriteLockNeeded ? WRITE : READ);
            if (acquired)
            {
               if (trace) log.trace("Acquired lock on node " + node.getFqn());
               te.addLock(node.getLock());
            }
            else
            {
               throw new CacheException("Unable to acquire lock on node " + node.getFqn());
            }
View Full Code Here

    *
    * @param gtx which holds locks
    */
   private void unlock(GlobalTransaction gtx)
   {
      TransactionEntry entry = txTable.get(gtx);
      entry.releaseAllLocksFIFO(gtx);
   }
View Full Code Here

   }

   protected void copyInvocationScopeOptionsToTxScope(InvocationContext ctx)
   {
      // notify the transaction entry that this override is in place.
      TransactionEntry entry = txTable.get(ctx.getGlobalTransaction());
      if (entry != null)
      {
         Option txScopeOption = new Option();
         txScopeOption.setCacheModeLocal(ctx.getOptionOverrides() != null && ctx.getOptionOverrides().isCacheModeLocal());
         txScopeOption.setSkipCacheStatusCheck(ctx.getOptionOverrides() != null && ctx.getOptionOverrides().isSkipCacheStatusCheck());
         entry.setOption(txScopeOption);
      }
   }
View Full Code Here

   {
      if (t == null)
      {
         return false;
      }
      TransactionEntry entry = txTable.get(t);
      for (MethodCall m : entry.getCacheLoaderModifications())
      {
         if (m.getMethodId() == MethodDeclarations.removeNodeMethodLocal_id
               && fqn.isChildOrEquals((Fqn) m.getArgs()[1]))
         {
            return true;
View Full Code Here

      assertNotNull("Tx should have been set up by now", cache.getInvocationContext().getTransaction());
      assertEquals("The same current transaction should be associated with this invocation ctx.", tm.getTransaction(), cache.getInvocationContext().getTransaction());
      assertNotNull("Gtx should have been set up by now", cache.getInvocationContext().getGlobalTransaction());

      Transaction tx = tm.getTransaction();
      TransactionEntry entry = tt.get(tt.get(tx));

      if (commit)
      {
         tm.commit();
      }
      else
      {
         tm.rollback();
      }

      assertNull("Tx should have been scrubbed", cache.getInvocationContext().getTransaction());
      assertNull("Gtx should have been scrubbed", cache.getInvocationContext().getGlobalTransaction());
      assertEquals("MethodCall should have been scrubbed", null, cache.getInvocationContext().getMethodCall());

      // check that the transaction entry hasn't leaked stuff.
      assert entry.getModifications().isEmpty() : "Should have scrubbed modifications in transaction entry";
      assert entry.getCacheLoaderModifications().isEmpty() : "Should have scrubbed modifications in transaction entry";
      assert entry.getOrderedSynchronizationHandler() == null : "Should have removed the ordered sync handler";
   }
View Full Code Here

      // pass up the chain.
      Object retval = invokeNextInterceptor(ctx, command);
      if (!skipReplicationOfTransactionMethod(ctx))
      {
         GlobalTransaction gtx = getGlobalTransaction(ctx);
         TransactionEntry te = ctx.getTransactionEntry();
         if (te.hasLocalModifications())
         {
            OptimisticPrepareCommand replicablePrepareCommand = command.clone(); // makre sure we remove any "local" transactions
            replicablePrepareCommand.removeModifications(te.getLocalModifications());
            command = replicablePrepareCommand;
         }

         // replicate the prepare call.
         broadcastPrepare(command, gtx, ctx);
View Full Code Here

TOP

Related Classes of org.jboss.cache.transaction.TransactionEntry

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.