/**
  * File: 		TransactionsHandler.java
  * Content: 	part of the RMI specification of sensei domains
  *           Interface defining transaction operations
  * Author: 	LuisM Pena
  * Date: 		27th October 2001
  * Version:  0.51.00
  * Last change:
  *
  **/


package sensei.middleware.domains;

import java.rmi.Remote;
import java.rmi.RemoteException;

/**
  * Interface defining transaction operations
  */
public interface TransactionsHandler extends Remote
{
  /**
   * Starts a transaction, locking first the given monitor.
   * Transactions can be nested, but nested transactions only end when the initial transaction
   * is finished.
   * A system on a transaction does not start any state transfer, and all the messages
   * sent by the group handler are queued until the transaction ends. As the result, messages
   * can be seen by other members in different views, and this interface is therefore only
   * allowed under mode MembersOnTransferExcludedFromGroup.
   * @exception MonitorException if the monitor is not valid
   * @exception TransactionException if transactions are not allowed
   */
  public void startTransaction(Monitor monitor)
    throws MonitorException, TransactionException, MemberStateException, RemoteException;

  /**
   * Ends a transaction, unlocking the given monitor. The operation only takes place, in case
   * of nested transactions, when the initial transaction ends.
   * @exception MonitorException if the monitor used for the transaction has been unlocked inside
   *            the transaction
   * @exception TransactionException if transactions are not allowed or there is not any current transaction
   */
  public void endTransaction()
    throws MonitorException, TransactionException, MemberStateException, RemoteException;

};