divijvaidya commented on pull request #1502: URL: https://github.com/apache/tinkerpop/pull/1502#issuecomment-997810991
> after looking at this a bit, i'm not sure i see how we can get this change in without some form of breaking change to the `Traversal` API. @divijvaidya maybe i'm not envisioning the change as you were seeing it happen...thoughts? I am proposing the following changes, let me know if they sound good to you. 1. Add an abstract method to `Traversal.java` called `notifyClosed()` 2. That method should be called inside `close()` method of `Traversal.java` 3. `DefaultTraversal.java` should have a member called `isClosed` which would be set to `true` inside it's implementation of `notifyClosed()`. `DefaultTraversal` would also have a method called `isClosed()` which will return the value of `isClosed` member. 4. In the `hasNext()` method of `DefaultTraversal`, it will check if `isClosed()` is true and if yes, then it will return false. Note that this is not breaking in the sense that today the behaviour of iterator hasNext() after being closed in undefined. We are correcting the semantics here such that you cannot access the iterator when it is closed already. Same change for `next()`, it should return NoSuchElement exception when called on closed iterator. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
