public interface LockContainer<L extends Lock>
Modifier and Type | Method and Description |
---|---|
L |
acquireLock(Object lockOwner,
Object key,
long timeout,
TimeUnit unit)
Attempts to acquire a lock for the given object within certain time boundaries defined by the timeout and
time unit parameters.
|
L |
getLock(Object key) |
int |
getLockId(Object key)
Returns the 'id' of the lock that will be used to guard access to a given key in the cache.
|
int |
getNumLocksHeld() |
boolean |
isLocked(Object key) |
boolean |
ownsLock(Object key,
Object owner)
Tests if a give owner owns a lock on a specified object.
|
void |
releaseLock(Object lockOwner,
Object key)
Release lock on the given key.
|
int |
size() |
boolean ownsLock(Object key, Object owner)
key
- object to checkowner
- owner to testboolean isLocked(Object key)
key
- objectint getNumLocksHeld()
int size()
L acquireLock(Object lockOwner, Object key, long timeout, TimeUnit unit) throws InterruptedException
key
- Object to acquire lock ontimeout
- Time after which the lock acquisition will failunit
- Time unit of the given timeoutInterruptedException
- If the lock acquisition was interruptedvoid releaseLock(Object lockOwner, Object key)
key
- Object on which lock is to be removedint getLockId(Object key)
key
- key to test forCopyright © 2012 JBoss by Red Hat. All Rights Reserved.