[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15437813#comment-15437813
 ] 

Edward Ribeiro commented on ZOOKEEPER-2511:
-------------------------------------------

Very nice patch [~abrahamfine], 

A public interface is a contract and change it during minor releases (3.5.x, 
etc) is a *no-no*, afaik. Usually, this kind of backward incompatible change is 
postponed to major releases (e.g., 4.0). This is the reason why ZOOKEEPER-1362 
has never been committed even though it is a trivial and really nice to have 
property (that is, to make ACLs immutable): because they are public fields that 
a lot of clients could rely on. Better to set up expectations that those fields 
are going to change on major releases, imho.

So, about [~hanm] solutions:

{quote}
1. Don't catch InterruptedException in ClientCnx::close. No signature change to 
ZooKeeper::close.
2. Just remove throw InterruptedException from ZooKeeper::close, because it 
does not throw such exception. Client code that catching this exception will 
need update to remove the catch, so this is not backward compatible.
3. Do nothing with regards to fix the interface, and use the solution proposed 
in this patch to suppress warning.
{quote}

* The second solution is out of question but for a major release (another 
ticket?)

* Even though the first solution is backward compatible this brings us again to 
square one, so that it can lead to undefined behavior when using ARM blocks 
(aka try-with-resources) that are a nice feature to have, imho.

* The third solution looks the most appropriate, IMHO. I suggest that we 
document that {{InterruptedException}} is never thrown and will eventually be 
removed in future releases.

> Implement AutoCloseable in ZooKeeper.java
> -----------------------------------------
>
>                 Key: ZOOKEEPER-2511
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2511
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: Abraham Fine
>            Assignee: Abraham Fine
>             Fix For: 3.5.3
>
>         Attachments: ZOOKEEPER-2511.patch
>
>
> As a java developer I would like to be able to use try-with-resource blocks 
> with ZooKeeper objects in order to make closing sessions easier.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to