neo4j/neo4j — pull request #1155 by tinwelint (2013-09-06 13:09:02+00:00)
Title: Traversals are executed in one statement

READ: not necessarily to be merged as is right now, hacked it up perhaps too quickly. Just have a look if you feel like it.

o Because of that org.neo4j.graph.traversal.Traverser is now a
ResourceIterable so that it produces closeable traverser iterators.
o Introduced Resource which extends AutoCloseable which has got a
close() method that doesn't throw any checked exceptions. That made
sense since ResourceIterator had a close() method like that and if you
would like to use the "closeable" aspect such an iterator as an argument
you previously passed it in as Closeable or AutoCloseable and caught
IOException just re-throw it as RuntimeException, not that such
IOException would occur of course.
o Kernel API statements also extend Resource instead of AutoCloseable,
since statements were often used together with an iterator to form a
ResourceIterator (which had an exception-less close() method). See the
point above for more information.
o A traverser that reaches the end will also automatically close itself.