com.nhncorp.neptune.common
Class NeptuneLock

java.lang.Object
  extended by com.nhncorp.neptune.common.NeptuneLock

public class NeptuneLock
extends java.lang.Object

HLocking is a set of lock primitives that does not rely on a particular thread holding the monitor for an object. This is especially important when a lock must persist over multiple RPC's since there is no guarantee that the same Server thread will handle all the RPC's until the lock is released. Not requiring that the locker thread is same as unlocking thread is the key distinction between this class and ReentrantReadWriteLock.

For each independent entity that needs locking, create a new HLocking instance.


Constructor Summary
NeptuneLock()
          Constructor
 
Method Summary
 void obtainReadLock()
          Caller needs the nonexclusive read-lock
 void obtainWriteLock()
          Caller needs the exclusive write-lock
 void releaseReadLock()
          Caller is finished with the nonexclusive read-lock
 void releaseWriteLock()
          Caller is finished with the write lock
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeptuneLock

public NeptuneLock()
Constructor

Method Detail

obtainReadLock

public void obtainReadLock()
Caller needs the nonexclusive read-lock


releaseReadLock

public void releaseReadLock()
Caller is finished with the nonexclusive read-lock


obtainWriteLock

public void obtainWriteLock()
Caller needs the exclusive write-lock


releaseWriteLock

public void releaseWriteLock()
Caller is finished with the write lock