Nice Addition Back in Neo4j 1.9.1: Closeable ExecutionResult
Neo4j 1.9.1 now has the addition of the ExecutionEngine feature!
When using Cypher from Java code, you instantiate an ExecutionEngine and it calls execute to get an instance of ExecutionResult. ExecutionResult is an Iterable and therefore provides access to an iterator() method.
Up to Neo4j 1.9, it is recommended to fully consume the iterator until hasNext() returns null, otherwise it’s not guaranteed that all resources are freed up again. Since Neo4j 1.9.1 ExecutionResult implements ResourceIterable as well. This means the iterator has a close() method to free up bound resources without completely consuming the iterator.
Read the Full Article Here.