|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jasig.cas.ticket.registry.support.JpaLockingStrategy
public class JpaLockingStrategy
JPA 2.0 implementation of an exclusive, non-reintrant lock.
| Nested Class Summary | |
|---|---|
static class |
JpaLockingStrategy.Lock
Describes a database lock. |
| Field Summary | |
|---|---|
static int |
DEFAULT_LOCK_TIMEOUT
Default lock timeout is 1 hour. |
protected javax.persistence.EntityManager |
entityManager
Transactional entity manager from Spring context. |
| Constructor Summary | |
|---|---|
JpaLockingStrategy()
|
|
| Method Summary | |
|---|---|
boolean |
acquire()
Attempt to acquire the lock. |
String |
getOwner()
Gets the current owner of the lock as determined by querying for uniqueId. |
void |
release()
Release the lock if held. |
void |
setApplicationId(String id)
|
void |
setLockTimeout(int seconds)
|
void |
setUniqueId(String id)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_LOCK_TIMEOUT
@NotNull protected javax.persistence.EntityManager entityManager
| Constructor Detail |
|---|
public JpaLockingStrategy()
| Method Detail |
|---|
public void setApplicationId(String id)
id - Application identifier that identifies a row in the lock
table for which multiple clients vie to hold the lock.
This must be the same for all clients contending for a
particular lock.public void setUniqueId(String id)
id - Identifier used to identify this instance in a row of the
lock table. Must be unique across all clients vying for
locks for a given application ID.public void setLockTimeout(int seconds)
seconds - Maximum amount of time in seconds lock may be held.
A value of zero indicates that locks are held indefinitely.
Use of a reasonable timeout facilitates recovery from node failures,
so setting to zero is discouraged.@Transactional(readOnly=false) public boolean acquire()
acquire in interface LockingStrategy@Transactional(readOnly=false) public void release()
release in interface LockingStrategy@Transactional(readOnly=true) public String getOwner()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||