-
Notifications
You must be signed in to change notification settings - Fork 40
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
AblyRealtime should implement Autocloseable #514
Comments
Is that going to be possible, given that we already declare |
@paddybyers yes, it will be possible: implementors of an interface can choose to implement more specific methods: this means It's also stated in Autocloseable's javadoc:
|
Right, but it was the |
@paddybyers yes, |
I noticed all or most of our tests for
AblyRealtime
have thetry-catch-finally
pattern, becuase the instantiatedAblyRealtime
objects need to be closed. I suspect that also in "real" usage, the object has to be closed when its no longer needed.In order to simplify things, this class should implement Autocloseable and be used in
try-with-resources
, which was introduced in Java 7. Then, the code can be simplified a lot for our clients and also in our tests. Instead of this:we will have this:
Note that this change will not affect backwards compatibility!
The text was updated successfully, but these errors were encountered: