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

import org.jboss.tm.TransactionImpl;

/**
 * A policy that checks a transaction before allowing a commit
 *
 * @author <a href="adrian@jboss.com">Adrian Brock</a>
 * @version $Revision: 1.1.2.2 $
 */
public interface TransactionIntegrity
{
   /**
    * Checks whether a transaction can be committed.<p>
    * 
    * The policy is allowed to wait, e.g. if there
    * are other threads still associated with the transaction.<p>
    * 
    * This method is invoked before any transaction synchronizations'
    * beforeCompletions.<p>
    *
    * This policy should not invoke any methods that change the
    * state of the transaction other than <code>setRollbackOnly()</code>
    * to force a rollback or registering a transaction synchronization.
    * 
    * @param transaction the transaction
    * @throws SecurityException if a commit is not allowed from this context
    */
   void checkTransactionIntegrity(TransactionImpl transaction);
}
