RFR: 2410: Introduce process killing finally block in GitCommits

Pavel Rappo prappo at openjdk.org
Wed Nov 20 15:30:23 UTC 2024


On Wed, 20 Nov 2024 13:38:07 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> I think the loop needs to make sure the inner close method is called on each process by catching exceptions

Correct.

> and saving one of them, probably the first one, and then rethrow it once all processes have been dealt with.

You don't need to figure out which exception you need to save. Save all of them. For that, use java.lang.Throwable::addSuppressed.

> In practice I doubt there will ever be multiple processes though. That would only happen if `::iterator` is called multiple times.

Also true. I only pointed out that the `close` method is not adequate for the current state of the class. Either `close` should account for multiple iterators, or it should throw an exception if more than one iterator is created.

I guess `GitCommits` is itera_BLE_ and not itera_TOR_ only to be able to be used with the enhanced `for` statement. Tradeoffs were made.

-------------

PR Review Comment: https://git.openjdk.org/skara/pull/1697#discussion_r1850531104


More information about the skara-dev mailing list