org.hypergraphdb.util
Class HGLock

java.lang.Object
  extended by org.hypergraphdb.util.HGLock
All Implemented Interfaces:
java.util.concurrent.locks.ReadWriteLock

public class HGLock
extends java.lang.Object
implements java.util.concurrent.locks.ReadWriteLock

An implementation of ReadWriteLock that will use the currently active database transaction if there is one (through BDBTxLock) or a default ReentrantReadWriteLock if there is no current transaction. The implementation is useful for runtime data structures that need protection from concurrent access and that may or may not participate in a database transaction.

Author:
Borislav Iordanov

Constructor Summary
HGLock(HyperGraph graph, byte[] objectId)
           
 
Method Summary
 java.util.concurrent.locks.Lock readLock()
           
 java.util.concurrent.locks.Lock writeLock()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HGLock

public HGLock(HyperGraph graph,
              byte[] objectId)
Method Detail

readLock

public java.util.concurrent.locks.Lock readLock()
Specified by:
readLock in interface java.util.concurrent.locks.ReadWriteLock

writeLock

public java.util.concurrent.locks.Lock writeLock()
Specified by:
writeLock in interface java.util.concurrent.locks.ReadWriteLock