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

import javax.transaction.Transaction;

/**
 * The interface to implementated for a transaction local implementation
 *
 * @author <a href="mailto:adrian@jboss.org">Adrian Brock</a>
 * @version $Revision: 1.2.6.2 $
 */
public interface TransactionLocalDelegate
{
   /**
    * get the transaction local value.
    */
   Object getValue(TransactionLocal local, Transaction tx);

   /**
    * put the value in the transaction local
    */
   void storeValue(TransactionLocal local, Transaction tx, Object value);

   /**
    * does Transaction contain object?
    */
   boolean containsValue(TransactionLocal local, Transaction tx);
   
   /**
    * Lock the transaction local in the context of this transaction
    * 
    * @throws IllegalStateException if the transaction is not active
    * @throws InterruptedException if the thread is interrupted
    */
   void lock(TransactionLocal local, Transaction tx) throws InterruptedException;
   
   /**
    * Unlock the transaction local in the context of this transaction
    */
   void unlock(TransactionLocal local, Transaction tx);
}
