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

Thomas Koch commented on ZOOKEEPER-836:
---------------------------------------

Hi Benjamin,

I'm happy that we found something we both like! About the exception I had the 
following thoughts:

- Well, obviously I don't consider class proliferation an issue. I'd always 
prefer adding a new class instead of having 500+ lines gorilla classes that 
needs hours to understand.

- I'm not sure on that one: Shouldn't it be a very rare exception :-) to throw 
unchecked exceptions? I'd use unchecked exceptions when I'm very sure at 
programming time, that either this problem should never happen in the first 
plane or when there is nothing, my caller code could do to handle this 
exception and the best thing to do is to blow up the whole process.

- I've had a look through standard Java Exceptions but didn't find any that 
would've made sense, so I wrote my own. Throwing just an instance of 
"Exception" seemed to unspecific.

- I'm re-throwing as an IllegalArgumentException in ZooKeeper to not break API 
compatibility. If I could break API compatibility, then I'd just pass it 
through.

- Even better then passing it through is my long term goal for dependency 
injection: The ZooKeeper class shouldn't instantiate a ClientCnxn in the first 
place. There should be a ZooKeeper( ClientCnxn cnxn ) constructor. However this 
is possible only after ZOOKEEPER-837.

> hostlist as string
> ------------------
>
>                 Key: ZOOKEEPER-836
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-836
>             Project: ZooKeeper
>          Issue Type: Sub-task
>          Components: java client
>    Affects Versions: 3.3.1
>            Reporter: Patrick Datko
>            Assignee: Thomas Koch
>         Attachments: ZOOKEEPER-836.patch, ZOOKEEPER-836.patch
>
>
> The hostlist is parsed in the ctor of ClientCnxn. This violates the rule of 
> not doing (too much) work in a ctor. Instead the ClientCnxn should receive an 
> object of class "HostSet". HostSet could then be instantiated e.g. with a 
> comma separated string.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to