Package org.jboss.cache

Examples of org.jboss.cache.GlobalTransaction


        if (optionOverride!= null && optionOverride.isFailSilently() && ctx.getTransaction() != null)
        {
           // make sure we remove the tx and global tx from the transaction table, since we don't care about this transaction
           // and will just suspend it.  - JBCACHE-1246
           GlobalTransaction gtx = txTable.remove(ctx.getTransaction());
           if (gtx != null) txTable.remove(gtx);

           suspendedTransaction = txManager.suspend();
           // set the tx in the invocation context to null now! - JBCACHE-785
           ctx.setTransaction(null);
View Full Code Here


    private MethodCall attachGlobalTransaction(Transaction tx, MethodCall m) throws Exception
    {
        if (log.isDebugEnabled()) log.debug(" local transaction exists - registering global tx if not present for " + Thread.currentThread());
        if (log.isTraceEnabled())
        {
            GlobalTransaction tempGtx = txTable.get(tx);
            log.trace("Associated gtx in txTable is " + tempGtx);
        }

        // register a sync handler for this tx - only if the gtx is not remotely initiated.
        GlobalTransaction gtx = registerTransaction(tx);
        if (gtx != null)
        {
            m = replaceGtx(m, gtx);
        }
        else
View Full Code Here

     * @return
     * @throws Throwable
     */
    private Object handleCommitRollback(MethodCall m) throws Throwable
    {
        GlobalTransaction gtx = findGlobalTransaction( m.getArgs() );
        Object result;

        // this must have a local transaction associated if a prepare has been
        // callled before
        //Transaction ltx = getLocalTxForGlobalTx(gtx);
View Full Code Here

     * @return
     * @throws Exception
     */
    private GlobalTransaction registerTransaction(Transaction tx) throws Exception
    {
        GlobalTransaction gtx;
        if (isValid(tx) && transactions.put(tx, NULL) == null)
        {
            gtx = cache.getCurrentTransaction(tx);
            if (gtx.isRemote())
            {
                // should be no need to register a handler since this a remotely initiated gtx
                if (log.isTraceEnabled()) {log.trace("is a remotely initiated gtx so no need to register a tx for it");}
            }
            else
View Full Code Here

      JBCMethodCall cleanup = MethodCallFactory.create(MethodDeclarations.dataGravitationCleanupMethod, new Object[]{getInvocationContext().getGlobalTransaction(), backup.primaryFqn, backup.backupFqn});


      if (log.isTraceEnabled()) log.trace("Performing cleanup on [" + backup.primaryFqn + "]");
      GlobalTransaction gtx = getInvocationContext().getGlobalTransaction();
      if (gtx == null)
      {
         // broadcast removes
         // remove main Fqn
         //replicateCall(cache.getMembers(), primaryDataCleanup, syncCommunications);
View Full Code Here

   }

   private void createNode(boolean localOnly, List nodeData) throws CacheException
   {
      Iterator nodes = nodeData.iterator();
      GlobalTransaction gtx = getInvocationContext().getGlobalTransaction();

      while (nodes.hasNext())
      {
         NodeData data = (NodeData) nodes.next();
         if (localOnly)
View Full Code Here

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);

        GlobalTransaction gtx = cache.getCurrentTransaction(tx);
        TransactionTable table = cache.getTransactionTable();
        OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
        assertNotNull(mgr.getTransaction());
        mgr.commit();


        GlobalTransaction remoteGtx = new GlobalTransaction();

        remoteGtx.setAddress(new Address()
        {

            public int compareTo(Object arg0)
            {
                return 0;
            }

            public void readFrom(DataInputStream arg0) throws IOException,
                    IllegalAccessException, InstantiationException
            {

            }

            public void writeTo(DataOutputStream arg0) throws IOException
            {

            }

            public void readExternal(ObjectInput arg0) throws IOException,
                    ClassNotFoundException
            {

            }

            public void writeExternal(ObjectOutput arg0) throws IOException
            {

            }

            public int size()
            {
                return 0;
            }

            public boolean isMulticastAddress()
            {
                return false;
            }

        });
        //hack the method call to make it have the remote gtx
        MethodCall meth = (MethodCall) entry.getModifications().get(0);

        meth.getArgs()[0] = remoteGtx;
        //call our remote method
        MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod, new Object[]{remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE});
        try
        {
            cache._replicate(prepareMethod);
        }
        catch (Throwable t)
View Full Code Here

        //start local transaction
        mgr.begin();
        Transaction tx = mgr.getTransaction();

        //this sets
        GlobalTransaction gtx = cache.getCurrentTransaction(tx);

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);
View Full Code Here

        SamplePojo pojo = new SamplePojo(21, "test");

        cache.put("/one/two", "key1", pojo);

        GlobalTransaction gtx = cache.getCurrentTransaction(tx);
        TransactionTable table = cache.getTransactionTable();
        assertNotNull(mgr.getTransaction());
        mgr.commit();

View Full Code Here

       }

       if (tx_mgr != null && tx_mgr.getTransaction() != null) {
           // we have a tx running.
           log.trace("transactional so don't put stuff in the cloader yet.");
           GlobalTransaction gtx = getInvocationContext().getGlobalTransaction();
           switch (m.getMethodId())
           {
              case MethodDeclarations.commitMethod_id:
                 if (getInvocationContext().isTxHasMods()) {
                    // this is a commit call.
View Full Code Here

TOP

Related Classes of org.jboss.cache.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.