ozone core API

org.ozoneDB.core
Class ExclusiveLock

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

public final class ExclusiveLock
extends AbstractLock

This class implements an exclusive lock policy. Only one transaction can hold this lock at one time.

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

Field Summary
private  int level
           
 TransactionID locker
          ID of the Transaction that holds this lock or null.
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
ExclusiveLock()
           
 
Method Summary
 TransactionID getLocker()
           
 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()
           
 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, toString, 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

locker

public TransactionID locker
ID of the Transaction that holds this lock or null.

Constructor Detail

ExclusiveLock

public ExclusiveLock()
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.

getLocker

public TransactionID getLocker()

ozone core API

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