RFR: Make sure Commits are closed when using Commits::stream

Jorn Vernee via github.com duke at openjdk.java.net
Fri Aug 30 10:21:32 UTC 2019


I noticed most places that are using `Commits::stream` are not actually closing the underlying resource.

I've added an `onClose` handler to the returned stream, and also overrode `forEach` (from `Iterable`) to call close. Unfortunately, the stream `onClose` handler is not called automatically when a terminal operation occurs, so we still have to use try-with-resources when using `Commits::stream` (which I've addressed).

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

Commits:
 - 05de00bc:	Make sure `Commits` are closed when calling `Commits::stream`.
 - a5687db1:	Add onClose operation to Commits::stream to avoid resource leaks

Pull request:
https://git.openjdk.java.net/skara/pull/111

Webrev:
https://webrevs.openjdk.java.net/skara/111/webrev.00

Patch:
https://git.openjdk.java.net/skara/pull/111.diff

Fetch command:
git fetch https://git.openjdk.java.net/skara pull/111/head:pull/111


More information about the skara-dev mailing list