public abstract class FqnLockManager extends AbstractLockManager
configuration, lockAcquisitionTimeout
Constructor and Description |
---|
FqnLockManager() |
Modifier and Type | Method and Description |
---|---|
Collection<Object> |
getReadOwners(NodeSPI node)
Retrieves the read lock owners, if any, for the current Fqn.
|
Object |
getWriteOwner(NodeSPI node)
Retrieves the write lock owner, if any, for the current Fqn.
|
boolean |
isLocked(NodeSPI node)
Returns true if the node is locked (either for reading or writing) by anyone, and false otherwise.
|
boolean |
lock(NodeSPI node,
LockType lockType,
Object owner)
As
LockManager.lock(org.jboss.cache.Fqn, LockType, Object) except that a NodeSPI is passed in instead of an Fqn. |
boolean |
lock(NodeSPI node,
LockType lockType,
Object owner,
long timeout)
As
LockManager.lock(org.jboss.cache.Fqn, LockType, Object, long) except that a NodeSPI is passed in instead of an Fqn. |
boolean |
lockAndRecord(NodeSPI node,
LockType lockType,
InvocationContext ctx)
Acquires a lock of type lockType, on a specific Node in the cache, denoted by fqn.
|
boolean |
ownsLock(NodeSPI node,
Object owner)
Tests whether a given owner owns any sort of lock on a particular Fqn.
|
void |
unlock(NodeSPI node,
Object owner)
Releases the lock passed in, held by the specified owner
|
getLockOwner, injectConfiguration, setLockAcquisitionTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getReadOwners, getWriteOwner, isLocked, isLocked, lock, lock, lockAll, lockAll, lockAll, lockAllAndRecord, lockAllAndRecord, lockAndRecord, ownsLock, ownsLock, printLockInfo, printLockInfo, unlock, unlock, unlockAll, unlockAll
public boolean lock(NodeSPI node, LockType lockType, Object owner) throws InterruptedException
LockManager
LockManager.lock(org.jboss.cache.Fqn, LockType, Object)
except that a NodeSPI is passed in instead of an Fqn.node
- node to locklockType
- type of lock to acquireowner
- owner to acquire the lock forInterruptedException
public boolean lock(NodeSPI node, LockType lockType, Object owner, long timeout) throws InterruptedException
LockManager
LockManager.lock(org.jboss.cache.Fqn, LockType, Object, long)
except that a NodeSPI is passed in instead of an Fqn.node
- node to locklockType
- type of lock to acquireowner
- owner to acquire the lock fortimeout
- maximum length of time to wait for (in millis)InterruptedException
public boolean lockAndRecord(NodeSPI node, LockType lockType, InvocationContext ctx) throws InterruptedException
LockManager
Option.getLockAcquisitionTimeout()
and, if this is unset, the default timeout
set in Configuration.getLockAcquisitionTimeout()
is used.
In addition, any locks acquired are added to the context OR transaction entry using InvocationContext.addLock(Object)
.
The owner for the lock is determined by passing the invocation context to LockManager.getLockOwner(org.jboss.cache.InvocationContext)
.
node
- Fqn to locklockType
- type of lock to acquirectx
- invocation context associated with this invocationInterruptedException
public void unlock(NodeSPI node, Object owner)
LockManager
node
- Node to unlockowner
- lock ownerpublic boolean ownsLock(NodeSPI node, Object owner)
LockManager
node
- to testowner
- ownerpublic Object getWriteOwner(NodeSPI node)
LockManager
node
- the node to inspectpublic Collection<Object> getReadOwners(NodeSPI node)
LockManager
node
- the node to inspectpublic boolean isLocked(NodeSPI node)
LockManager
node
- node to inspectCopyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.