info.aduna.iteration
Interface CloseableIteration<E,X extends Exception>

All Superinterfaces:
Iteration<E,X>
All Known Implementing Classes:
CloseableIterationBase, CloseableIteratorIteration, ConvertingIteration, ConvertingIterator, DelayedIteration, DelayedIterator, DistinctIteration, DistinctIterator, EmptyIteration, EmptyIterator, ExceptionConvertingIteration, FilterIteration, FilterIterator, IntersectIteration, IntersectIterator, IterationWrapper, IteratorWrapper, LimitIteration, LimitIterator, LockingIteration, LockingIterator, LookAheadIteration, LookAheadIterator, MinusIteration, MinusIterator, OffsetIteration, OffsetIterator, SingletonIteration, SingletonIterator, UnionIteration, UnionIterator

public interface CloseableIteration<E,X extends Exception>
extends Iteration<E,X>

An Iteration that can be closed to free resources that it is holding. CloseableIterations automatically free their resources when exhausted. If not read until exhaustion or if you want to make sure the iteration is properly closed, any code using the iterator should be placed in a try-catch-finally block, closing the iteration in the finally, e.g.:

 CloseableIteration<Object, Exception> iter = ...
 try {
    // read objects from the iterator
 }
 catch(Exception e) {
   // process the exception that can be thrown while processing.
 }
 finally {
    iter.close();
 }
 


Method Summary
 void close()
          Closes this iteration, freeing any resources that it is holding.
 
Methods inherited from interface info.aduna.iteration.Iteration
hasNext, next, remove
 

Method Detail

close

void close()
           throws X extends Exception
Closes this iteration, freeing any resources that it is holding. If the iteration has already been closed then invoking this method has no effect.

Throws:
X extends Exception


Copyright © 1997-2008 Aduna. All Rights Reserved.