Skip to content
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

Guard against IO resource leak with streams #10731

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

findepi
Copy link
Member

@findepi findepi commented Jan 21, 2022

No description provided.

Copy link
Contributor

@ksobolew ksobolew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

.sorted()
.collect(toImmutableList());
try (DirectoryStream<Path> directoryStream = newDirectoryStream(path.toPath())) {
return stream(directoryStream)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could go one step further and use Files::list, which returns a Stream<Path>, so that calling Streams::stream is not necessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of scope.

Copy link
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@findepi findepi merged commit 43c3824 into trinodb:master Jan 21, 2022
@findepi findepi deleted the findepi/steam-leak branch January 21, 2022 17:25
@github-actions github-actions bot added this to the 369 milestone Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants