Skip to content

Guard against IO resource leak with streams#10731

Merged
findepi merged 1 commit intotrinodb:masterfrom
findepi:findepi/steam-leak
Jan 21, 2022
Merged

Guard against IO resource leak with streams#10731
findepi merged 1 commit intotrinodb:masterfrom
findepi:findepi/steam-leak

Conversation

@findepi
Copy link
Copy Markdown
Member

@findepi findepi commented Jan 21, 2022

No description provided.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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