org.apache.ojb.otm.lock
Class ObjectLock

java.lang.Object
  extended by org.apache.ojb.otm.lock.ObjectLock

public class ObjectLock
extends Object

Represents the locks held for an object. The basic assertion is that at any given point in time, there can be multiple readers, but just one writer.

Author:
Raghu Rajah

Nested Class Summary
private  class ObjectLock.LockEntry
           
 
Field Summary
private  Identity _oid
           
private  HashMap _readers
           
private  ObjectLock.LockEntry _writer
           
 
Constructor Summary
ObjectLock(Identity oid)
           
 
Method Summary
 boolean doesReaderExists()
           
 Collection getReaders()
           
 Identity getTargetIdentity()
           
 Transaction getWriter()
           
 boolean isFree()
           
 boolean isReader(Transaction tx)
           
 void readLock(Transaction tx)
           
 void releaseLock(Transaction tx)
           
 void waitForTx(Transaction tx)
           
 void writeLock(Transaction tx)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_oid

private Identity _oid

_writer

private ObjectLock.LockEntry _writer

_readers

private HashMap _readers
Constructor Detail

ObjectLock

public ObjectLock(Identity oid)
Method Detail

getTargetIdentity

public Identity getTargetIdentity()

getWriter

public Transaction getWriter()

isReader

public boolean isReader(Transaction tx)

doesReaderExists

public boolean doesReaderExists()

getReaders

public Collection getReaders()

readLock

public void readLock(Transaction tx)

writeLock

public void writeLock(Transaction tx)
               throws LockingException
Throws:
LockingException

releaseLock

public void releaseLock(Transaction tx)

waitForTx

public void waitForTx(Transaction tx)
               throws LockingException
Throws:
LockingException

isFree

public boolean isFree()


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.