-
Notifications
You must be signed in to change notification settings - Fork 240
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
Add closeOnExcept to clean up code that closes resources only on exceptions #456
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abellina
previously approved these changes
Jul 28, 2020
build |
revans2
requested changes
Jul 29, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look fine but could you please sign your commit like we are asking others to do.
…exceptions Signed-off-by: Jason Lowe <[email protected]>
build |
revans2
approved these changes
Jul 29, 2020
We need the fix from #461 or to turn off the noscaladoc rule before the CI build is going to pass. |
build |
nartal1
pushed a commit
to nartal1/spark-rapids
that referenced
this pull request
Jun 9, 2021
…exceptions (NVIDIA#456) Signed-off-by: Jason Lowe <[email protected]>
nartal1
pushed a commit
to nartal1/spark-rapids
that referenced
this pull request
Jun 9, 2021
…exceptions (NVIDIA#456) Signed-off-by: Jason Lowe <[email protected]>
pxLi
pushed a commit
to pxLi/spark-rapids
that referenced
this pull request
May 12, 2022
* update FLAdminAPI runner * fix typo
tgravescs
pushed a commit
to tgravescs/spark-rapids
that referenced
this pull request
Nov 30, 2023
Signed-off-by: spark-rapids automation <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been bumping into a number of cases where a resource is obtained, some computation needs to happen on that resource, then ownership of the resource is handed off to somewhere else. During the computation it's important to cover the exception path, which means writing code that looks something like this:
The
withResource
code is a nice wrapper for handling the case where a resource must always be closed, but we don't have something to cover the case where a resource should only be closed if an exception occurs.This PR adds
closeOnExcept
methods that are similar towithResource
but closing in acatch
clause rather than afinally
block. It also updates code that was using this code pattern.