Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Nice Addition Back in Neo4j 1.9.1: Closeable ExecutionResult

DZone's Guide to

Nice Addition Back in Neo4j 1.9.1: Closeable ExecutionResult

· Java Zone
Free Resource

The single app analytics solutions to take your web and mobile apps to the next level.  Try today!  Brought to you in partnership with CA Technologies

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.

I guess a lot of Neo4j users might not have explored that small but very helpful addition yet, so I think it’s worth mentioning.

CA App Experience Analytics, a whole new level of visibility. Learn more. Brought to you in partnership with CA Technologies.

Topics:

Published at DZone with permission of Stefan Armbruster, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}