org.apache.openjpa.jdbc.kernel
Class PessimisticLockManager

java.lang.Object
  extended by org.apache.openjpa.kernel.AbstractLockManager
      extended by org.apache.openjpa.kernel.VersionLockManager
          extended by org.apache.openjpa.jdbc.kernel.PessimisticLockManager
All Implemented Interfaces:
JDBCLockManager, LockLevels, LockManager, Closeable

public class PessimisticLockManager
extends VersionLockManager
implements JDBCLockManager

Lock manager that uses exclusive database locks.

Author:
Marc Prud'hommeaux

Field Summary
static int LOCK_DATASTORE_ONLY
           
 
Fields inherited from class org.apache.openjpa.kernel.AbstractLockManager
ctx, log
 
Fields inherited from interface org.apache.openjpa.kernel.LockLevels
LOCK_NONE, LOCK_READ, LOCK_WRITE
 
Constructor Summary
PessimisticLockManager()
           
 
Method Summary
 void loadedForUpdate(OpenJPAStateManager sm)
          Notification that the given instance was loaded via a result set produced by a FOR UPDATE select.
protected  void lockInternal(OpenJPAStateManager sm, int level, int timeout, Object sdata)
          Marks the instance's transactional status in accordance with the settings of VersionLockManager.getVersionCheckOnReadLock() and VersionLockManager.getVersionUpdateOnWriteLock().
 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 setContext(StoreContext ctx)
          Set the context this lock manager is associated with.
 
Methods inherited from class org.apache.openjpa.kernel.VersionLockManager
getLockLevel, getVersionCheckOnReadLock, getVersionUpdateOnWriteLock, lock, release, setLockLevel, setVersionCheckOnReadLock, setVersionUpdateOnWriteLock
 
Methods inherited from class org.apache.openjpa.kernel.AbstractLockManager
beginTransaction, close, endTransaction, getContext, lockAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.kernel.LockManager
beginTransaction, close, endTransaction, getLockLevel, lock, lockAll, release
 

Field Detail

LOCK_DATASTORE_ONLY

public static final int LOCK_DATASTORE_ONLY
See Also:
Constant Field Values
Constructor Detail

PessimisticLockManager

public PessimisticLockManager()
Method Detail

setContext

public void setContext(StoreContext ctx)
Description copied from interface: LockManager
Set the context this lock manager is associated with. This will be invoked in the lock manager before any other methods are called.

Specified by:
setContext in interface LockManager
Overrides:
setContext 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(OpenJPAStateManager 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

lockInternal

protected void lockInternal(OpenJPAStateManager sm,
                            int level,
                            int timeout,
                            Object sdata)
Description copied from class: VersionLockManager
Marks the instance's transactional status in accordance with the settings of VersionLockManager.getVersionCheckOnReadLock() and VersionLockManager.getVersionUpdateOnWriteLock(). Override to perform additional locking.

Overrides:
lockInternal in class VersionLockManager
See Also:
StoreContext.transactional(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.