com.distributed.api
Class Lock

java.lang.Object
  |
  +--com.distributed.api.Lock

public class Lock
extends java.lang.Object

Class to implement Mutual Exclusion or Lock


Method Summary
 boolean isLockAvailable()
          Method to see if Lock is available
 boolean receiveOkay()
          Method to take action when OK is received
 void receiveRequest(int hispid, int hists)
          Method to take action when a request is received
 void releaseLock()
          Method to release a lock or Mutex
 void requestLock()
          Method to request a Lock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isLockAvailable

public boolean isLockAvailable()
Method to see if Lock is available

Returns:
true if Mutex is available

receiveOkay

public boolean receiveOkay()
Method to take action when OK is received

Returns:
True if Mutex is achieved, False otherwise

receiveRequest

public void receiveRequest(int hispid,
                           int hists)
Method to take action when a request is received

Parameters:
hispid - ID of requesting Process
hists - Timestamp of the request

releaseLock

public void releaseLock()
Method to release a lock or Mutex


requestLock

public void requestLock()
Method to request a Lock