public interface LockManager extends Closeable, LockLevels
LOCK_NONE, LOCK_READ, LOCK_WRITE
Modifier and Type | Method and Description |
---|---|
void |
beginTransaction()
Notification that a transaction is beginning.
|
void |
close()
Free any resources.
|
void |
endTransaction()
Notification that the current transaction has ended.
|
int |
getLockLevel(OpenJPAStateManager sm)
Return the lock level of the specified instance, or
LockLevels.LOCK_NONE if not locked. |
void |
lock(OpenJPAStateManager sm,
int level,
int timeout,
Object sdata)
Obtain a lock on the specified object.
|
void |
lockAll(Collection sms,
int level,
int timeout,
Object sdata)
Obtain locks on the specified objects.
|
void |
refreshLock(OpenJPAStateManager sm,
int level,
int timeout,
Object sdata)
Perform the same function as previous lock method and has the option
to perform a version check after the lock function has completed.
|
void |
release(OpenJPAStateManager sm)
Release the lock on the given object.
|
void |
setContext(StoreContext ctx)
Set the context this lock manager is associated with.
|
void setContext(StoreContext ctx)
int getLockLevel(OpenJPAStateManager sm)
LockLevels.LOCK_NONE
if not locked.void lock(OpenJPAStateManager sm, int level, int timeout, Object sdata)
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 itLockException
- if a lock cannot be
obtained in the given number of millisecondsOpenJPAStateManager.setLock(java.lang.Object)
void refreshLock(OpenJPAStateManager sm, int level, int timeout, Object sdata)
void lockAll(Collection sms, int level, int timeout, Object sdata)
void release(OpenJPAStateManager sm)
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.void beginTransaction()
void endTransaction()
Copyright © 2006–2017 Apache Software Foundation. All rights reserved.