ozone core API

org.ozoneDB.core
Class SharedLock

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

public final class SharedLock
extends AbstractLock

This class implements a non-exclusive lock policy. Multiple transactions may hold this lock.

Version:
$Revision: 1.4 $Date: 2002/09/18 06:54:15 $
Author:
SMB
See Also:
Serialized Form

Field Summary
private  int level
           
 DxSet lockers
          All transactions that hold this lock.
private  int prevLevel
           
protected static long serialVersionUID
           
protected static byte subSerialVersionUID
           
 
Fields inherited from interface org.ozoneDB.core.Lock
LEVEL_MAX, LEVEL_NONE, LEVEL_READ, LEVEL_UPGRADE, LEVEL_WRITE, NOT_ACQUIRED
 
Constructor Summary
SharedLock()
           
 
Method Summary
 boolean areMultipleLockersHoldingLocks()
           
 boolean hasChanged()
           
 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.
 int previousLevel()
           
 void release(Transaction ta)
          Release the previously aquired lock.
 void reset()
           
 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

level

private int level

prevLevel

private transient int prevLevel

lockers

public DxSet lockers
All transactions that hold this lock. Holds TransactionIDs.

Constructor Detail

SharedLock

public SharedLock()
Method Detail

reset

public void reset()

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.

release

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


isAcquiredBy

public boolean isAcquiredBy(Transaction ta)

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.

previousLevel

public int previousLevel()

areMultipleLockersHoldingLocks

public boolean areMultipleLockersHoldingLocks()

hasChanged

public boolean hasChanged()

toString

public java.lang.String toString()

ozone core API

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