org.entityfs.util.itr
Class AbstractLockingIterator

java.lang.Object
  extended by org.entityfs.util.itr.AbstractLockingIterator
Direct Known Subclasses:
AbstractNoLockingIterator, AbstractPessimisticLockingIterator, OptimisticLockingDepthLastIterator

public abstract class AbstractLockingIterator
extends Object

An abstract base class for LockingIterator:s. It implements the unlock(EntityView) and unlockAll() methods.

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

Constructor Summary
protected AbstractLockingIterator(boolean writeLock)
           
 
Method Summary
protected  void assertNotUnlocked()
          Verify that the client has not called unlockAll().
protected  void lock(EntityView ev)
          Subclasses call this to lock an entity.
 void unlock(EntityView ev)
           
 void unlockAll()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLockingIterator

protected AbstractLockingIterator(boolean writeLock)
Method Detail

assertNotUnlocked

protected void assertNotUnlocked()
                          throws IllegalStateException
Verify that the client has not called unlockAll().

Throws:
IllegalStateException - If the client has called unlockAll().

lock

protected void lock(EntityView ev)
Subclasses call this to lock an entity.

Parameters:
ev - The entity to lock.

unlock

public void unlock(EntityView ev)
            throws EntityNotFoundException
Throws:
EntityNotFoundException

unlockAll

public void unlockAll()