SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

kodo.jdbc.runtime
Class PessimisticLockManager

java.lang.Object
  |
  +--kodo.runtime.AbstractLockManager
        |
        +--kodo.jdbc.runtime.PessimisticLockManager
All Implemented Interfaces:
com.solarmetric.util.Closeable, JDBCLockManager, LockManager

public class PessimisticLockManager
extends AbstractLockManager
implements JDBCLockManager

Lock manager that uses exclusive database locks.


Fields inherited from class kodo.runtime.AbstractLockManager
log, pm
 
Constructor Summary
PessimisticLockManager()
           
 
Method Summary
 int getLockLevel(KodoStateManager sm)
          Return the lock level of the specified instance, or KodoPersistenceManager.LOCK_NONE if not locked.
 void loadedForUpdate(KodoStateManager sm)
          Notification that the given instance was loaded via a result set produced by a FOR UPDATE select.
 void lock(KodoStateManager sm, int level, int timeout, Object context)
          Obtain a lock on the specified object.
 void release(KodoStateManager sm)
          Release the lock on the given object.
 boolean selectForUpdate(Select sel, int lockLevel)
          Return whether to issue the given select FOR UPDATE, depending on the capabilities of the dictionary and the fetch configuration.
 void setPersistenceManager(KodoPersistenceManager pm)
          Set the persistence manager this lock manager is associated with.
 
Methods inherited from class kodo.runtime.AbstractLockManager
beginTransaction, close, endTransaction, getPersistenceManager, lockAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface kodo.runtime.LockManager
beginTransaction, close, endTransaction, lockAll
 

Constructor Detail

PessimisticLockManager

public PessimisticLockManager()
Method Detail

setPersistenceManager

public void setPersistenceManager(KodoPersistenceManager pm)
Description copied from interface: LockManager
Set the persistence manager this lock manager is associated with. This will be invoked in the lock manager before any other methods are called.
Specified by:
setPersistenceManager in interface LockManager
Overrides:
setPersistenceManager in class AbstractLockManager

selectForUpdate

public boolean selectForUpdate(Select sel,
                               int lockLevel)
Description copied from interface: JDBCLockManager
Return whether to issue the given select FOR UPDATE, depending on the capabilities of the dictionary and the fetch configuration.
Specified by:
selectForUpdate in interface JDBCLockManager

loadedForUpdate

public void loadedForUpdate(KodoStateManager sm)
Description copied from interface: JDBCLockManager
Notification that the given instance was loaded via a result set produced by a FOR UPDATE select.
Specified by:
loadedForUpdate in interface JDBCLockManager

release

public void release(KodoStateManager sm)
Description copied from interface: LockManager
Release the lock on the given object. This method will be called automatically for each state manager with a lock object set on transaction completion, just before the call to LockManager.endTransaction(). The lock manager should null the state manager's lock object. Note that some state manager may be garbage collected during a transaction; thus lock managers cannot rely on this method being called for every state manager.
Specified by:
release in interface LockManager
Following copied from interface: kodo.runtime.LockManager
See Also:
KodoStateManager.setLock(java.lang.Object)

getLockLevel

public int getLockLevel(KodoStateManager sm)
Description copied from interface: LockManager
Return the lock level of the specified instance, or KodoPersistenceManager.LOCK_NONE if not locked.
Specified by:
getLockLevel in interface LockManager

lock

public void lock(KodoStateManager sm,
                 int level,
                 int timeout,
                 Object context)
Description copied from interface: LockManager
Obtain a lock on the specified object. This method may be called when a user explicitly locks an object, and is also called automatically for every object accessed during a transaction. The implementation must track already-locked objects, and must be optimized to return quickly when the given object does not need additional locking. The lock manager might use the state manager's lock object for bookkeeping information.
Specified by:
lock in interface LockManager
Following copied from interface: kodo.runtime.LockManager
Parameters:
sm - the object to lock
level - one of the lock constants defined in KodoPersistenceManager, or a custom level
timeout - the timeout in milliseconds, or a negative number for no timeout
context - the context information passed from the back end store manager to the persistence manager, if any; lock managers specific to a certain back end may be able to take advantage of this; others should ignore it
Throws:
LockTimedOutException - if a lock cannot be obtained in the given number of milliseconds
See Also:
KodoStateManager.setLock(java.lang.Object)

SolarMetric Kodo JDO 3.3.5 generated on August 31 2005

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.