info.aduna.collections.iterators
Class LockingIterator<E>

java.lang.Object
  extended by info.aduna.iteration.CloseableIterationBase<E,X>
      extended by info.aduna.iteration.IterationWrapper<E,X>
          extended by info.aduna.iteration.LockingIteration<E,RuntimeException>
              extended by info.aduna.collections.iterators.LockingIterator<E>
All Implemented Interfaces:
CloseableIterator<E>, CloseableIteration<E,RuntimeException>, Iteration<E,RuntimeException>, Closeable, Iterator<E>

public class LockingIterator<E>
extends LockingIteration<E,RuntimeException>
implements CloseableIterator<E>

An iterator that holds on to a lock until the iterator is closed. Upon closing, the underlying iterator is closed before the lock is released.


Field Summary
 
Fields inherited from class info.aduna.iteration.IterationWrapper
wrappedIter
 
Fields inherited from class info.aduna.iteration.CloseableIterationBase
logger
 
Constructor Summary
LockingIterator(Lock lock, Iterator<? extends E> iter)
          Creates a new LockingIterator.
 
Method Summary
 
Methods inherited from class info.aduna.iteration.LockingIteration
handleClose, hasNext
 
Methods inherited from class info.aduna.iteration.IterationWrapper
next, remove
 
Methods inherited from class info.aduna.iteration.CloseableIterationBase
close, isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.aduna.collections.iterators.CloseableIterator
close
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

LockingIterator

public LockingIterator(Lock lock,
                       Iterator<? extends E> iter)
Creates a new LockingIterator.

Parameters:
lock - The lock to release when the itererator is closed, must not be null.
iter - The underlying iterator, must not be null.


Copyright © 1997-2008 Aduna. All Rights Reserved.