Package org.apache.openjpa.jdbc.kernel
Class PessimisticLockManager
java.lang.Object
org.apache.openjpa.kernel.AbstractLockManager
org.apache.openjpa.kernel.VersionLockManager
org.apache.openjpa.jdbc.kernel.PessimisticLockManager
- All Implemented Interfaces:
JDBCLockManager
,LockLevels
,LockManager
,Closeable
- Direct Known Subclasses:
MixedLockManager
Lock manager that uses exclusive database locks.
- Author:
- Marc Prud'hommeaux
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkLock
(ResultSet rs, OpenJPAStateManager sm, int timeout) This method is to provide override for non-JDBC or JDBC-like implementation of checking lock from the result set.protected ResultSet
executeQuery
(Connection conn, PreparedStatement stmnt, SQLBuffer sql) This method is to provide override for non-JDBC or JDBC-like implementation of executing query.getLockRows
(DBDictionary dict, Object id, ClassMapping mapping, JDBCFetchConfiguration fetch, SQLFactory factory) getStore()
void
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, boolean postVersionCheck) Marks the instance's transactional status in accordance with the settings ofVersionLockManager.getVersionCheckOnReadLock()
andVersionLockManager.getVersionUpdateOnWriteLock()
.protected void
lockJoinTables
(List<SQLBuffer> sqls, DBDictionary dict, Object id, ClassMapping mapping, JDBCFetchConfiguration fetch, SQLFactory factory) protected PreparedStatement
prepareStatement
(Connection conn, SQLBuffer sql) This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.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, optimisticLockInternal, refreshLock, release, setLockLevel, setVersionCheckOnReadLock, setVersionUpdateOnWriteLock
Methods inherited from class org.apache.openjpa.kernel.AbstractLockManager
beginTransaction, close, endTransaction, getContext, lockAll, skipRelationFieldLock
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.jdbc.kernel.JDBCLockManager
skipRelationFieldLock
Methods inherited from interface org.apache.openjpa.kernel.LockManager
beginTransaction, close, endTransaction, getLockLevel, lock, lockAll, refreshLock, release
-
Field Details
-
LOCK_DATASTORE_ONLY
public static final int LOCK_DATASTORE_ONLY- See Also:
-
_store
-
-
Constructor Details
-
PessimisticLockManager
public PessimisticLockManager()
-
-
Method Details
-
setContext
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 interfaceLockManager
- Overrides:
setContext
in classAbstractLockManager
-
selectForUpdate
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 interfaceJDBCLockManager
-
loadedForUpdate
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 interfaceJDBCLockManager
-
lockInternal
protected void lockInternal(OpenJPAStateManager sm, int level, int timeout, Object sdata, boolean postVersionCheck) Description copied from class:VersionLockManager
Marks the instance's transactional status in accordance with the settings ofVersionLockManager.getVersionCheckOnReadLock()
andVersionLockManager.getVersionUpdateOnWriteLock()
. Override to perform additional locking.- Overrides:
lockInternal
in classVersionLockManager
- See Also:
-
getLockRows
protected List<SQLBuffer> getLockRows(DBDictionary dict, Object id, ClassMapping mapping, JDBCFetchConfiguration fetch, SQLFactory factory) -
lockJoinTables
protected void lockJoinTables(List<SQLBuffer> sqls, DBDictionary dict, Object id, ClassMapping mapping, JDBCFetchConfiguration fetch, SQLFactory factory) -
getStore
-
prepareStatement
This method is to provide override for non-JDBC or JDBC-like implementation of preparing statement.- Throws:
SQLException
-
executeQuery
protected ResultSet executeQuery(Connection conn, PreparedStatement stmnt, SQLBuffer sql) throws SQLException This method is to provide override for non-JDBC or JDBC-like implementation of executing query.- Throws:
SQLException
-
checkLock
This method is to provide override for non-JDBC or JDBC-like implementation of checking lock from the result set.- Throws:
SQLException
-