|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.openjpa.kernel.AbstractLockManager org.apache.openjpa.kernel.VersionLockManager
public class VersionLockManager
LockManager
implementation that provides support
for version checking and version updating when locks are acquired.
This lock manager may be used standalone or extended for additional locking.
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 | |
---|---|
VersionLockManager()
|
Method Summary | |
---|---|
int |
getLockLevel(OpenJPAStateManager sm)
Returns the given instance's lock level, assuming that the state's lock object is a number. |
boolean |
getVersionCheckOnReadLock()
Whether or not we should force a version check at commit time when a read lock is requested in order to verify read consistency. |
boolean |
getVersionUpdateOnWriteLock()
Whether or not we should force an update to the version at commit time when a write lock is requested. |
void |
lock(OpenJPAStateManager sm,
int level,
int timeout,
Object sdata)
Delegates to lockInternal(org.apache.openjpa.kernel.OpenJPAStateManager, int, int, java.lang.Object) after traversing to owning
instance (if embedded) and assuring that the instance is persistent,
is not new, and is not already locked at a higher level. |
protected void |
lockInternal(OpenJPAStateManager sm,
int level,
int timeout,
Object sdata)
Marks the instance's transactional status in accordance with the settings of getVersionCheckOnReadLock()
and getVersionUpdateOnWriteLock() . |
void |
release(OpenJPAStateManager sm)
Nulls given instance's lock object. |
protected void |
setLockLevel(OpenJPAStateManager sm,
int level)
Sets the given instance's lock level to the given number. |
void |
setVersionCheckOnReadLock(boolean versionCheckOnReadLock)
Whether or not we should force a version check at commit time when a read lock is requested in order to verify read consistency. |
void |
setVersionUpdateOnWriteLock(boolean versionUpdateOnWriteLock)
Whether or not we should force an update to the version at commit time when a write lock is requested. |
Methods inherited from class org.apache.openjpa.kernel.AbstractLockManager |
---|
beginTransaction, close, endTransaction, getContext, lockAll, setContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VersionLockManager()
Method Detail |
---|
public int getLockLevel(OpenJPAStateManager sm)
protected void setLockLevel(OpenJPAStateManager sm, int level)
public void release(OpenJPAStateManager sm)
OpenJPAStateManager.setLock(java.lang.Object)
public void lock(OpenJPAStateManager sm, int level, int timeout, Object sdata)
lockInternal(org.apache.openjpa.kernel.OpenJPAStateManager, int, int, java.lang.Object)
after traversing to owning
instance (if embedded) and assuring that the instance is persistent,
is not new, and is not already locked at a higher level. After
locking, calls setLockLevel(org.apache.openjpa.kernel.OpenJPAStateManager, int)
with the given level.
sm
- the object to locklevel
- one of the lock constants defined in LockLevels
,
or a custom leveltimeout
- the timeout in milliseconds, or a negative number for
no timeoutsdata
- the context information passed from the store manager
to the persistence context, if any; lock managers
specific to a certain back end may be able to take
advantage of this; others should ignore itOpenJPAStateManager.setLock(java.lang.Object)
protected void lockInternal(OpenJPAStateManager sm, int level, int timeout, Object sdata)
getVersionCheckOnReadLock()
and getVersionUpdateOnWriteLock()
. Override to perform
additional locking.
StoreContext.transactional(java.lang.Object, boolean, org.apache.openjpa.kernel.OpCallbacks)
public void setVersionCheckOnReadLock(boolean versionCheckOnReadLock)
public boolean getVersionCheckOnReadLock()
public void setVersionUpdateOnWriteLock(boolean versionUpdateOnWriteLock)
public boolean getVersionUpdateOnWriteLock()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |