Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2010, Red Hat, Inc. and/or its affiliates,
   * and individual contributors as indicated by the @author tags.
   * See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   * This copyrighted material is made available to anyone wishing to use,
   * modify, copy, or redistribute it subject to the terms and conditions
   * of the GNU Lesser General Public License, v. 2.1.
  * This program is distributed in the hope that it will be useful, but WITHOUT A
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
  * You should have received a copy of the GNU Lesser General Public License,
  * v.2.1 along with this distribution; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  *
  * (C) 2010,
  * @author JBoss, by Red Hat.
  */
 package com.arjuna.ats.internal.jta.recovery.arjunacore;
 
 
 
An XAResourceOrphanFilter which vetos rollback for xids owned by top level JTA transactions.

Author(s):
Jonathan Halliday (jonathan.halliday@redhat.com), 2010-03
 
 {
     @Override
     public Vote checkXid(Xid xid)
     {
         if(xid.getFormatId() != .) {
             // we only care about Xids created by the JTA
             return .;
         }
 
         if(transactionLog(xid)) {
             // it's owned by a logged transaction which
             // will recover it top down in due course
             return .;
         }
 
         return .;
     }
 
     private boolean containsCommitMarkableResourceRecord(Uid u) {
         try {
             InputObjectState state = StoreManager.getRecoveryStore().read_committed(
                     u.);
             if (state != null) {
 
                 return (rcaa.containsIncompleteCommitMarkableResourceRecord());
             }
         } catch (ObjectStoreException e) {
         } catch (IOException e) {
         }
 
         return false;
     }

    
Is there a log file for this transaction?

Parameters:
xid the transaction to check.
Returns:
booleantrue if there is a log file, false if there isn't.
 
     private boolean transactionLog(Xid xid)
     {
         RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
         String transactionType = new AtomicAction().type();
 
         XidImple theXid = new XidImple(xid);
         Uid u = theXid.getTransactionUid();
 
         if (..isDebugEnabled()) {
             ..debug("Checking whether Xid "
                     + theXid + " exists in ObjectStore.");
        }
        if (!u.equals(Uid.nullUid()))
        {
            try
            {
                if (..isDebugEnabled()) {
                    ..debug("Looking for " + u + " and " + transactionType);
                }
                if ( containsCommitMarkableResourceRecord(u) ||
                        recoveryStore.currentState(utransactionType) != .)
                {
                    if (..isDebugEnabled()) {
                        ..debug("Found record for " + theXid);
                    }
                    return true;
                }
                else
                {
                    if (..isDebugEnabled()) {
                        ..debug("No record found for " + theXid);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }
        }
        else
        {
            ..info_recovery_notaxid(XAHelper.xidToString(xid));
        }
        return false;
    }
New to GrepCode? Check out our FAQ X