public class JdbcLockRegistry extends java.lang.Object implements ExpirableLockRegistry
LockRegistry
using a shared database to co-ordinate the locks. Provides the
same semantics as the DefaultLockRegistry
, but the locks taken will be global,
as long as the underlying database supports the "serializable" isolation level in its
transactions.Constructor and Description |
---|
JdbcLockRegistry(LockRepository client) |
Modifier and Type | Method and Description |
---|---|
void |
expireUnusedOlderThan(long age)
Remove locks last acquired more than 'age' ago that are not currently locked.
|
java.util.concurrent.locks.Lock |
obtain(java.lang.Object lockKey)
Obtains the lock associated with the parameter object.
|
public JdbcLockRegistry(LockRepository client)
public java.util.concurrent.locks.Lock obtain(java.lang.Object lockKey)
LockRegistry
obtain
in interface LockRegistry
lockKey
- The object with which the lock is associated.public void expireUnusedOlderThan(long age)
ExpirableLockRegistry
expireUnusedOlderThan
in interface ExpirableLockRegistry
age
- the time since the lock was last obtained.