public interface CloseableIteration<E,X extends Exception> extends Iteration<E,X>
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(); }
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this iteration, freeing any resources that it is holding.
|
Copyright © 2001-2016 Aduna. All Rights Reserved.