/*
 * JBoss, the OpenSource J2EE webOS
 * 
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.tm.integrity;

import javax.transaction.Transaction;

import org.jboss.logging.Logger;
import org.jboss.tm.TransactionImpl;

/**
 * A NOOP implementation of transaction integrity.<p>
 * 
 * Implementations should extend this for future compatibility.
 * 
 * @author <a href="adrian@jboss.com">Adrian Brock</a>
 * @version $Revision: 1.1.2.3 $
 */
public class AbstractTransactionIntegrity implements TransactionIntegrity
{
   /** The log */
   protected Logger log = Logger.getLogger(getClass());
   
   public void checkTransactionIntegrity(TransactionImpl transaction)
   {
      // Do nothing
   }
   
   /**
    * Mark the transaction for rollback
    * 
    * @param transaction the transacton
    */
   protected void markRollback(Transaction transaction)
   {
      try
      {
         transaction.setRollbackOnly();
      }
      catch (Exception e)
      {
         log.warn("Unable to mark the transaction for rollback " + transaction, e);
      }
   }
}
