com.espertech.esper.collection
Class SafeIteratorImpl<E>

java.lang.Object
  extended by com.espertech.esper.collection.SafeIteratorImpl<E>
All Implemented Interfaces:
SafeIterator<E>, java.util.Iterator<E>
Direct Known Subclasses:
SafeIteratorWTableImpl

public class SafeIteratorImpl<E>
extends java.lang.Object
implements SafeIterator<E>

Implements the safe iterator. The class is passed a lock that is locked already, to release when the close method closes the iterator.


Constructor Summary
SafeIteratorImpl(StatementAgentInstanceLock iteratorLock, java.util.Iterator<E> underlying)
          Ctor.
 
Method Summary
 void close()
          Close the safe itertor, releasing locks.
 boolean hasNext()
           
 E next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SafeIteratorImpl

public SafeIteratorImpl(StatementAgentInstanceLock iteratorLock,
                        java.util.Iterator<E> underlying)
Ctor.

Parameters:
iteratorLock - for locking resources to safely-iterate over
underlying - is the underlying iterator to protect
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<E>

next

public E next()
Specified by:
next in interface java.util.Iterator<E>

close

public void close()
Description copied from interface: SafeIterator
Close the safe itertor, releasing locks. This is a required call and should preferably occur in a finally block.

Specified by:
close in interface SafeIterator<E>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<E>

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com