ozone core API

org.ozoneDB.core
Class MROWLock

java.lang.Object
  extended byorg.ozoneDB.core.AbstractLock
      extended byorg.ozoneDB.core.MROWLock
All Implemented Interfaces:
Lock, java.io.Serializable

public final class MROWLock
extends AbstractLock

This class implements a Multiple Reader One Writer lock policy.

Version:
$Revision: 1.4.2.4 $Date: 2004/01/15 22:02:38 $
Author:
SMB, Medium.net
See Also:
Serialized Form

Field Summary
protected  java.lang.String debugInfo
           
protected static boolean enableReleaseOfReadlockOnFailedWritelock
           
private  int level
           
private  SharedLock readLock
           
protected static long serialVersionUID
           
protected static byte subSerialVersionUID
           
private  ExclusiveLock writeLock
           
 
Fields inherited from interface org.ozoneDB.core.Lock
LEVEL_MAX, LEVEL_NONE, LEVEL_READ, LEVEL_UPGRADE, LEVEL_WRITE, NOT_ACQUIRED
 
Constructor Summary
MROWLock()
           
 
Method Summary
protected  boolean acquire(Transaction ta, int newLevel)
           
 TransactionID getWriteLockingTransactionID()
           
 boolean isAcquiredBy(Transaction ta)
           
 int level(Transaction ta)
          Returns the lock level for the specified transaction.
 DxCollection lockerIDs()
          Return all transactions that currently hold this lock.
 void release(Transaction ta)
          Release the previously aquired lock.
 void reset()
           
 void setDebugInfo(java.lang.String debugInfo)
           
 java.lang.String toString()
           
 int tryAcquire(Transaction ta, int newLevel)
          Try to aquire this lock.
 
Methods inherited from class org.ozoneDB.core.AbstractLock
checkDeadlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
See Also:
Constant Field Values

subSerialVersionUID

protected static final byte subSerialVersionUID
See Also:
Constant Field Values

enableReleaseOfReadlockOnFailedWritelock

protected static final boolean enableReleaseOfReadlockOnFailedWritelock
See Also:
Constant Field Values

level

private int level

readLock

private SharedLock readLock

writeLock

private ExclusiveLock writeLock

debugInfo

protected transient java.lang.String debugInfo
Constructor Detail

MROWLock

public MROWLock()
Method Detail

reset

public void reset()

setDebugInfo

public void setDebugInfo(java.lang.String debugInfo)

tryAcquire

public int tryAcquire(Transaction ta,
                      int newLevel)
Description copied from interface: Lock
Try to aquire this lock. This method returns the previous level of the specified transaction, if the lock was sucessfully acquired. Otherwise it returns NOT_ACQUIRED.

Returns:
The previous level for the given transaction or NOT_ACQUIRED.

acquire

protected boolean acquire(Transaction ta,
                          int newLevel)

release

public void release(Transaction ta)
Description copied from interface: Lock
Release the previously aquired lock.


isAcquiredBy

public boolean isAcquiredBy(Transaction ta)

getWriteLockingTransactionID

public TransactionID getWriteLockingTransactionID()

lockerIDs

public DxCollection lockerIDs()
Description copied from interface: Lock
Return all transactions that currently hold this lock.


level

public int level(Transaction ta)
Description copied from interface: Lock
Returns the lock level for the specified transaction. If ta is null, then we do not check ta against the transaction that has acquired this lock.

Parameters:
ta - The transaction that has acquired the lock or null.
Returns:
Lock level for ta if ta has aquired the lock or ta is null. LEVEL_NONE otherwise.

toString

public java.lang.String toString()

ozone core API

Copyright (C) The Ozone Database Project - www.ozone-db.org. All rights reserved.