com.sleepycat.je.txn
Class LockUpgrade

java.lang.Object
  extended by com.sleepycat.je.txn.LockUpgrade

public class LockUpgrade
extends Object

LockUpgrade is a type safe enumeration of lock upgrade types. Methods on LockUpgrade objects are used to determine whether an upgrade is needed and, if so, how it should be handled.


Field Summary
static LockUpgrade EXISTING
           
static LockUpgrade ILLEGAL
           
static LockUpgrade RANGE_READ_IMMED
           
static LockUpgrade RANGE_WRITE_IMMED
           
static LockUpgrade RANGE_WRITE_PROMOTE
           
static LockUpgrade WRITE_PROMOTE
           
 
Method Summary
(package private)  boolean getIllegal()
          This method is called to determine whether the upgrade is illegal.
(package private)  boolean getPromotion()
          This method is called when getUpgrade returns non-null to determine whether the upgrade is a true promotion or can be granted immediately.
(package private)  LockType getUpgrade()
          This method is called first to determine whether an upgrade to a new lock type is needed, and what the new lock type should be.
 void setUpgrade(LockType upgrade)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ILLEGAL

public static final LockUpgrade ILLEGAL

EXISTING

public static final LockUpgrade EXISTING

WRITE_PROMOTE

public static final LockUpgrade WRITE_PROMOTE

RANGE_READ_IMMED

public static final LockUpgrade RANGE_READ_IMMED

RANGE_WRITE_IMMED

public static final LockUpgrade RANGE_WRITE_IMMED

RANGE_WRITE_PROMOTE

public static final LockUpgrade RANGE_WRITE_PROMOTE
Method Detail

getIllegal

boolean getIllegal()
This method is called to determine whether the upgrade is illegal. If true is returned, an internal error has occurred. This should never happen since RANGE_INSERT should never be requested along with other locks by the same locker; a separate locker is used for RANGE_INSERT locks.


getUpgrade

LockType getUpgrade()
This method is called first to determine whether an upgrade to a new lock type is needed, and what the new lock type should be. If null is returned, the existing lock should be unchanged and no upgrade is needed. If non-null is returned, an upgrade to the returned type should be performed; in this case, call getPromotion to determine how to do the upgrade.


setUpgrade

public void setUpgrade(LockType upgrade)

getPromotion

boolean getPromotion()
This method is called when getUpgrade returns non-null to determine whether the upgrade is a true promotion or can be granted immediately. A true promotion is a change from read to write locking, and may require waiting if the write lock conflicts with a lock held by another locker. An upgrade that is not a promotion is just a type change, and never causes a lock conflict.



Copyright (c) 2004-2010 Oracle. All rights reserved.