Package org.apache.jackrabbit.util
Class LockedWrapper<T>
- java.lang.Object
-
- org.apache.jackrabbit.util.Locked
-
- org.apache.jackrabbit.util.LockedWrapper<T>
-
public abstract class LockedWrapper<T> extends Locked
LockedWrapper
is a wrapper class toLocked
which adds generics support and wraps theLocked.TIMED_OUT
object into aLockException
.
-
-
Constructor Summary
Constructors Constructor Description LockedWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
with(Node lockable, boolean isDeep)
ExecutesLocked.run(javax.jcr.Node)
while the lock onlockable
is held.T
with(Node lockable, boolean isDeep, boolean isSessionScoped)
ExecutesLocked.run(javax.jcr.Node)
while the lock onlockable
is held.T
with(Node lockable, boolean isDeep, long timeout)
Executes the methodLocked.run(javax.jcr.Node)
within the scope of a lock held onlockable
.java.lang.Object
with(Node lockable, boolean isDeep, long timeout, boolean isSessionScoped)
Executes the methodLocked.run(javax.jcr.Node)
within the scope of a lock held onlockable
.
-
-
-
Method Detail
-
with
public T with(Node lockable, boolean isDeep) throws RepositoryException, java.lang.InterruptedException
Description copied from class:Locked
ExecutesLocked.run(javax.jcr.Node)
while the lock onlockable
is held. This method will block untilLocked.run(javax.jcr.Node)
is executed while holding the lock on nodelockable
.- Overrides:
with
in classLocked
- Parameters:
lockable
- a lockable node.isDeep
-true
iflockable
will be locked deep.- Returns:
- the object returned by
Locked.run(javax.jcr.Node)
. - Throws:
RepositoryException
- ifLocked.run(javax.jcr.Node)
throws an exception.java.lang.InterruptedException
- if this thread is interrupted while waiting for the lock on nodelockable
.
-
with
public T with(Node lockable, boolean isDeep, boolean isSessionScoped) throws RepositoryException, java.lang.InterruptedException
Description copied from class:Locked
ExecutesLocked.run(javax.jcr.Node)
while the lock onlockable
is held. This method will block untilLocked.run(javax.jcr.Node)
is executed while holding the lock on nodelockable
.- Overrides:
with
in classLocked
- Parameters:
lockable
- a lockable node.isDeep
-true
iflockable
will be locked deep.isSessionScoped
-true
if the lock is session scoped.- Returns:
- the object returned by
Locked.run(javax.jcr.Node)
. - Throws:
RepositoryException
- ifLocked.run(javax.jcr.Node)
throws an exception.java.lang.InterruptedException
- if this thread is interrupted while waiting for the lock on nodelockable
.
-
with
public T with(Node lockable, boolean isDeep, long timeout) throws UnsupportedRepositoryOperationException, RepositoryException, java.lang.InterruptedException
Description copied from class:Locked
Executes the methodLocked.run(javax.jcr.Node)
within the scope of a lock held onlockable
.- Overrides:
with
in classLocked
- Parameters:
lockable
- the node where the lock is obtained from.isDeep
-true
iflockable
will be locked deep.timeout
- time in milliseconds to wait at most to acquire the lock.- Returns:
- the object returned by
Locked.run(javax.jcr.Node)
orLocked.TIMED_OUT
if the lock onlockable
could not be acquired within the specified timeout. - Throws:
UnsupportedRepositoryOperationException
- if this repository does not support locking.RepositoryException
- ifLocked.run(javax.jcr.Node)
throws an exception.java.lang.InterruptedException
- if this thread is interrupted while waiting for the lock on nodelockable
.
-
with
public java.lang.Object with(Node lockable, boolean isDeep, long timeout, boolean isSessionScoped) throws UnsupportedRepositoryOperationException, RepositoryException, java.lang.InterruptedException
Description copied from class:Locked
Executes the methodLocked.run(javax.jcr.Node)
within the scope of a lock held onlockable
.- Overrides:
with
in classLocked
- Parameters:
lockable
- the node where the lock is obtained from.isDeep
-true
iflockable
will be locked deep.timeout
- time in milliseconds to wait at most to acquire the lock.isSessionScoped
-true
if the lock is session scoped.- Returns:
- the object returned by
Locked.run(javax.jcr.Node)
orLocked.TIMED_OUT
if the lock onlockable
could not be acquired within the specified timeout. - Throws:
UnsupportedRepositoryOperationException
- if this repository does not support locking.RepositoryException
- ifLocked.run(javax.jcr.Node)
throws an exception.java.lang.InterruptedException
- if this thread is interrupted while waiting for the lock on nodelockable
.
-
-