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

Close all methods #174

Merged
merged 2 commits into from
May 28, 2019
Merged

Close all methods #174

merged 2 commits into from
May 28, 2019

Conversation

RichardWarburton
Copy link
Contributor

A common situation is that you want to cleanup multiple of closeable objects. The existing close helper methods aren't very useful as they either suppress the exception or fail to guarantee that everything was closed. Here's a pair of utility methods from Artio that take a list or var-args array of closeables, guarantee they're all closed and don't suppress an exception if there is one. Pull requesting as I've had requests from other people for using this kind of method in non-artio projects and it agrona makes sense as a location.

return;
}

final List<Exception> exceptions = new ArrayList<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better if this was not allocated unless needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@mjpt777 mjpt777 merged commit 854f2a5 into real-logic:master May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants