zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiram Chirino (JIRA)" <j...@apache.org>
Subject [jira] Commented: (ZOOKEEPER-82) Make the ZooKeeperServer more DI friendly
Date Mon, 21 Jul 2008 19:27:31 GMT

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

Hiram Chirino commented on ZOOKEEPER-82:

While implementing this.. some smelly issues kinda poped out at me.  

The jmx stuff wants to be able to access the client port, to avoid tight coupling the jmx
stuff to the ServerConfig stuff, I added a clientPort field to the ZKServer.  Now that seems
a little smelly cause I can imagine that the ZKServer could in theory one day be extended
to operate on multiple ports.

In QuorumPeer, the constructor used to initialize sockets and other usefull bits.  To support
setter based injection, I moved this initialization to the start() method, so that users can:
QuorumPeer qp = new QuorumPeer();
qp.setDataLogDir( dir );
.... // more setter injection

The big difference is that QuorumPeer used to throw an IOException if the initialization failed,
now that exception occurs on qp.start() instead and it is wrapped up as a RuntimeException
since it's extending the Thread.start() method which does not allow IOExceptions to be thrown.

Perhaps QuorumPeer should implement Runnable instead of extending Thread so that a start()
method can be defined which does have the right signature. 

> Make the ZooKeeperServer more DI friendly
> -----------------------------------------
>                 Key: ZOOKEEPER-82
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-82
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: server
>            Reporter: Hiram Chirino
>         Attachments: ZOOKEEPER-82.patch
> Proposed changes were discussed in [this mailing list thread|http://mail-archives.apache.org/mod_mbox/hadoop-zookeeper-dev/200807.mbox/%3Caf2843cd0807180907v44b310bg232be99ac0b47a27@mail.gmail.com%3E]:
> Basic goals are: 
> * Decouple the current configuration system from the public API.  I
> see stuff like ZooKeeperServer being coupled to ServerConfig a bit.
> * Allow the use of setter injection in addition to constructor
> injection. This is the most important thing needed to let spring more
> easily configure the objects.
> * Move the main() methods out of the ZooKeeperServer class.

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

View raw message