/**
  * File: 		Monitor.java
  * Content: 	part of the RMI specification of sensei domains
  *           Interface defining a lock shared by replicas
  * 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 a lock shared by replicas
  */
public interface Monitor extends Remote
{
  /**
    * Locks the monitor.
    * This locking is reentrant: the member acquiring it can lock it again.
    * As a consequence, if the member intends to access the monitor from
    * different threads, it will have to include the synchronization
    * by itself
    **/
  public void lock() throws MemberStateException, RemoteException;

  /**
    * Unlocks the monitor;
    * @throws exception if the monitor was not locked by this member
    **/
  public void unlock() throws MonitorException, MemberStateException, RemoteException;
};