suncertify.db.util
Class LockObject

java.lang.Object
  |
  +--suncertify.db.util.Semaphore
        |
        +--suncertify.db.util.LockObject

public class LockObject
extends Semaphore

This Class represents the lock object - it is supose to know the id of the client owning the lock and has the lock object for others client that wants to wait for the unlock


Constructor Summary
LockObject(java.lang.String clientId)
          LockObject constructor
 
Method Summary
 boolean countingNotify()
          Methods notify the internal lock object.
 boolean countingNotifyAll()
          Methods notify all threads waiting on the internal lock object.
 void countingWait()
          Methods waits on the internal lock object.
 java.lang.String getClientId()
          Returns clientId string
 void setClientId(java.lang.String string)
          Sets the clientId string of the client currently ownig the lock
 
Methods inherited from class suncertify.db.util.Semaphore
P, V
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LockObject

public LockObject(java.lang.String clientId)
LockObject constructor

Parameters:
clientId - - the id of the client who wants to do the lock
Method Detail

getClientId

public java.lang.String getClientId()
Returns clientId string

Returns:
client id string

setClientId

public void setClientId(java.lang.String string)
Sets the clientId string of the client currently ownig the lock

Parameters:
string - - clientId

countingWait

public void countingWait()
                  throws java.lang.InterruptedException
Methods waits on the internal lock object. It supports counting the number of waitning threads

Throws:
java.lang.InterruptedException - @see Object#wait()

countingNotify

public boolean countingNotify()
Methods notify the internal lock object.

Returns:
it return true if no other thread is waiting on the internal lock object

countingNotifyAll

public boolean countingNotifyAll()
Methods notify all threads waiting on the internal lock object.

Returns:
it return true if no other thread is waiting on the internal lock object