-
Notifications
You must be signed in to change notification settings - Fork 807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TINKERPOP-1589 Re-introduced CloseableIterator #521
Conversation
Made it so that the CloseableIterator is closed by GraphStep if it is provided by the iterator supplier. Furthermore, any steps in a Traversal implement AutoCloseable then its close() method will be called.
Nice. Clean backwards compatible Are you looking for a VOTE now or are you still building on this PR? -- e.g. integrating it with |
I think I'm done - It's already implemented on |
@@ -254,9 +254,14 @@ public default void forEachRemaining(final Consumer<? super E> action) { | |||
} | |||
} | |||
|
|||
/** | |||
* Releases resources opened in any steps that implement {@link AutoCloseable}. | |||
*/ | |||
@Override | |||
public default void close() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is bad. Steps
that are TraversalParents
are responsible for propagating operations on them to those below. I would do the following:
// Traversal.close()
for(final Step<?,?> step : this.getSteps()) {
if(step instanceof AutoCloseable)
step.close();
}
Next, I would have TraversalParent
extend AutoCloseable
with its default close()
method being:
// TraversalParent.close()
for(final Traversal.Admin<?,?> traversal : this.getLocalChildren()) {
traversal.close()
}
for(final Traversal.Admin<?,? traversal: this.getGlobalChildren()) {
traversal.close();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes are made now - thanks - didn't know that stuff.
Implemented AutoCloseable on TraversalParent.
VOTE +1 |
1 similar comment
VOTE +1 |
VOTE: +1 |
https://issues.apache.org/jira/browse/TINKERPOP-1589
Made it so that the
CloseableIterator
is closed byGraphStep
if it is provided by the iterator supplier. Furthermore, any steps in aTraversal
implementAutoCloseable
then itsclose()
method will be called. In this wayTraversal.close()
, the common API a user will work with, has a way to release resources inGraph
implementations that require it.Builds with
docker/build.sh -t - i -n
.