org.entityfs.util.itr
Class PessimisticLockingDepthFirstIterator
java.lang.Object
org.entityfs.util.itr.AbstractLockingIterator
org.entityfs.util.itr.AbstractPessimisticLockingIterator
org.entityfs.util.itr.PessimisticLockingDepthFirstIterator
- All Implemented Interfaces:
- Iterator<EntityView>, DepthFirstIterator<EntityView>, LockingDepthFirstIterator<EntityView>, LockingIterator<EntityView>
public final class PessimisticLockingDepthFirstIterator
- extends AbstractPessimisticLockingIterator
- implements LockingDepthFirstIterator<EntityView>
This is a depth first iterator that will acquire locks for all returned
entities pessimistically. Locks for all entities that will be returned
are acquired (depth last) the first time next
or hasNext
is
called.
Use AbstractLockingIterator.unlock(EntityView)
and/or AbstractLockingIterator.unlockAll()
to unlock the
returned entities. Always call AbstractLockingIterator.unlockAll()
if the aborting the
iteration before all entities have been returned from the iterator or if
using a filter for filtering returned entities. See LockingIterator
.
EntityFS iterators are not thread safe. Don't use them concurrently from
several threads without synchronizing access to them.
- Since:
- 1.0
- Author:
- Karl Gustafsson
- See Also:
OptimisticLockingDepthLastIterator
,
PessimisticLockingDepthLastIterator
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PessimisticLockingDepthFirstIterator
public PessimisticLockingDepthFirstIterator(DirectoryView dv)
- Create a pessimistic depth first iterator on the directory. The directory
itself will be returned as the last entity from the iterator. All
returned entities are locked for reading.
- Parameters:
dv
- The directory.
PessimisticLockingDepthFirstIterator
public PessimisticLockingDepthFirstIterator(DirectoryView dv,
boolean writeLock)
- Create a pessimistic depth first iterator on the directory. The directory
itself will be returned as the last entity from the iterator.
- Parameters:
dv
- The directory.writeLock
- If true
, all returned entities are locked for
writing. If false
, all returned entities are locked for reading.
PessimisticLockingDepthFirstIterator
public PessimisticLockingDepthFirstIterator(DirectoryView dv,
boolean writeLock,
Filter<? super EntityView> filter)
- Create a pessimistic depth first iterator on the directory. Only entities
that pass the supplied filter will be returned from the iterator. The
directory itself will be returned as the last entity from the iterator if
it passes the filter.
- Parameters:
dv
- The directory.writeLock
- If true
, all returned entities are locked for
writing. If false
, all returned entities are locked for reading.filter
- Only entities that pass this filter are returned from the
iterator.