-
Notifications
You must be signed in to change notification settings - Fork 158
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
Added AutoCloseable interface to RiakClient #683
base: develop
Are you sure you want to change the base?
Conversation
*/ | ||
@Override | ||
public void close(){ | ||
this.shutdown(); |
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.
Shutdown method returns Future, therefore to respect AutoCloseable it might be better to call as follows:
this.shutdown().get();
Good point! I added that! |
The RiakCluster / RiakClient objects are supposed to be longer-lived and manage a pool of connections that can be shared across multiple threads. Are you envisioning using this like JDBC connections? |
|
@alexmoore Not only but in some cases it makes it easier to implement small projects @jplock could be a solution |
I vote for AutoCloseable as it is more generic and modern interface, with the more generic contract. But there is another issue, at the moment close() method is implemented as
, whereas:
from the javadoc |
@srgg hmm! Just catch it, doesn't seam enough! What kind of handling would you suggest? |
I just added the AutoCloseable Interface to RiakClient to use the Try-with-Resource Statement.