public class XALockManager extends Object implements LockManager, org.apache.jackrabbit.data.core.InternalXAResource
| Constructor and Description |
|---|
XALockManager(LockManagerImpl lockMgr)
Create a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLockToken(SessionImpl session,
String lt)
Invoked by a session to inform that a lock token has been added.
|
void |
afterOperation(org.apache.jackrabbit.data.core.TransactionContext tx) |
void |
associate(org.apache.jackrabbit.data.core.TransactionContext tx) |
void |
beforeOperation(org.apache.jackrabbit.data.core.TransactionContext tx) |
void |
checkLock(NodeImpl node)
Check whether the node given is locked by somebody else than the
current session.
|
void |
checkLock(org.apache.jackrabbit.spi.Path path,
javax.jcr.Session session)
Check whether the path given is locked by somebody else than the
session described.
|
void |
checkUnlock(javax.jcr.Session session,
NodeImpl node)
Returns
true if the specified session is allowed to unlock
the node; otherwise returns false. |
void |
commit(org.apache.jackrabbit.data.core.TransactionContext tx) |
boolean |
differentXAEnv(LockInfo info)
Return a flag indicating whether a lock info belongs to a different
XA environment.
|
javax.jcr.lock.Lock |
getLock(NodeImpl node)
Returns the Lock object that applies to a node.
|
javax.jcr.lock.Lock[] |
getLocks(SessionImpl session)
Returns all locks owned by the specified session.
|
boolean |
holdsLock(NodeImpl node)
Returns
true if the node given holds a lock;
otherwise returns false. |
boolean |
isLocked(NodeImpl node)
Returns
true if this node is locked either as a result
of a lock held by this node or by a deep lock on a node above this
node; otherwise returns false |
javax.jcr.lock.Lock |
lock(NodeImpl node,
boolean isDeep,
boolean isSessionScoped)
Lock a node.
|
javax.jcr.lock.Lock |
lock(NodeImpl node,
boolean isDeep,
boolean isSessionScoped,
long timoutHint,
String ownerInfo)
Lock a node.
|
void |
prepare(org.apache.jackrabbit.data.core.TransactionContext tx) |
void |
removeLockToken(SessionImpl session,
String lt)
Invoked by a session to inform that a lock token has been removed.
|
void |
rollback(org.apache.jackrabbit.data.core.TransactionContext tx) |
void |
unlock(NodeImpl node)
Removes the lock on a node given by its path.
|
public XALockManager(LockManagerImpl lockMgr)
lockMgr - lockMgr global lock managerpublic javax.jcr.lock.Lock lock(NodeImpl node, boolean isDeep, boolean isSessionScoped) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
lock in interface LockManagernode - nodeisDeep - whether the lock applies to this node onlyisSessionScoped - whether the lock is session scopedjavax.jcr.lock.LockException - if this node already is locked, or some descendant
node is locked and isDeep is truejavax.jcr.RepositoryExceptionNode.lock(boolean, boolean)public javax.jcr.lock.Lock lock(NodeImpl node, boolean isDeep, boolean isSessionScoped, long timoutHint, String ownerInfo) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
LockManagerlock in interface LockManagernode - Node to create the lock for.isDeep - whether the lock applies to this node onlyisSessionScoped - whether the lock is session scopedtimoutHint - Desired lock timeout in seconds.ownerInfo - Optional string acting as information about the owner.javax.jcr.lock.LockException - if this node already is locked, or some descendant
node is locked and isDeep is truejavax.jcr.RepositoryExceptionLockManager.lock(NodeImpl, boolean, boolean, long, String)public javax.jcr.lock.Lock getLock(NodeImpl node) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
getLock in interface LockManagernode - nodejavax.jcr.lock.LockException - if this node is not lockedjavax.jcr.RepositoryExceptionNode.getLock()public javax.jcr.lock.Lock[] getLocks(SessionImpl session) throws javax.jcr.RepositoryException
getLocks in interface LockManagersession - sessionjavax.jcr.RepositoryException - if an error occursSessionImpl.getLocks()public void unlock(NodeImpl node) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
unlock in interface LockManagernode - nodejavax.jcr.lock.LockException - if this node is not locked or the session
does not have the correct lock tokenjavax.jcr.RepositoryExceptionNode.unlock()public boolean holdsLock(NodeImpl node) throws javax.jcr.RepositoryException
true if the node given holds a lock;
otherwise returns false.holdsLock in interface LockManagernode - nodetrue if the node given holds a lock;
otherwise returns falsejavax.jcr.RepositoryException - If an exception occurs.Node.holdsLock()public boolean isLocked(NodeImpl node) throws javax.jcr.RepositoryException
true if this node is locked either as a result
of a lock held by this node or by a deep lock on a node above this
node; otherwise returns falseisLocked in interface LockManagernode - nodetrue if this node is locked either as a result
of a lock held by this node or by a deep lock on a node above this
node; otherwise returns falsejavax.jcr.RepositoryException - If an exception occurs.Node.isLocked()public void checkLock(NodeImpl node) throws javax.jcr.lock.LockException, javax.jcr.RepositoryException
checkLock in interface LockManagernode - node to checkjavax.jcr.lock.LockException - if write access to the specified node is not allowedjavax.jcr.RepositoryException - if some other error occurspublic void checkLock(org.apache.jackrabbit.spi.Path path,
javax.jcr.Session session)
throws javax.jcr.lock.LockException,
javax.jcr.RepositoryException
checkLock in interface LockManagerpath - path to checksession - sessionjavax.jcr.lock.LockException - if write access to the specified path is not allowedjavax.jcr.RepositoryException - if some other error occurspublic void checkUnlock(javax.jcr.Session session,
NodeImpl node)
throws javax.jcr.lock.LockException,
javax.jcr.RepositoryException
true if the specified session is allowed to unlock
the node; otherwise returns false.checkUnlock in interface LockManagersession - sessionnode - nodejavax.jcr.lock.LockException - if write access to the specified path is not allowedjavax.jcr.RepositoryException - if some other error occurspublic void addLockToken(SessionImpl session, String lt) throws javax.jcr.RepositoryException
addLockToken in interface LockManagersession - session that has a added lock tokenlt - added lock tokenjavax.jcr.lock.LockExceptionjavax.jcr.RepositoryExceptionpublic void removeLockToken(SessionImpl session, String lt) throws javax.jcr.RepositoryException
removeLockToken in interface LockManagersession - session that has a removed lock tokenlt - removed lock tokenjavax.jcr.lock.LockExceptionjavax.jcr.RepositoryExceptionpublic void associate(org.apache.jackrabbit.data.core.TransactionContext tx)
associate in interface org.apache.jackrabbit.data.core.InternalXAResourcepublic void beforeOperation(org.apache.jackrabbit.data.core.TransactionContext tx)
beforeOperation in interface org.apache.jackrabbit.data.core.InternalXAResourcepublic void prepare(org.apache.jackrabbit.data.core.TransactionContext tx)
throws org.apache.jackrabbit.data.core.TransactionException
prepare in interface org.apache.jackrabbit.data.core.InternalXAResourceorg.apache.jackrabbit.data.core.TransactionExceptionpublic void commit(org.apache.jackrabbit.data.core.TransactionContext tx)
This will finish the update and unlock the shared lock manager.
commit in interface org.apache.jackrabbit.data.core.InternalXAResourcepublic void rollback(org.apache.jackrabbit.data.core.TransactionContext tx)
This will undo all updates and unlock the shared lock manager.
rollback in interface org.apache.jackrabbit.data.core.InternalXAResourcepublic void afterOperation(org.apache.jackrabbit.data.core.TransactionContext tx)
afterOperation in interface org.apache.jackrabbit.data.core.InternalXAResourcepublic boolean differentXAEnv(LockInfo info)
Copyright © 2004-2016 The Apache Software Foundation. All Rights Reserved.