zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jakob Homan (JIRA)" <j...@apache.org>
Subject [jira] Updated: (ZOOKEEPER-139) Create Enums for WatcherEvent's KeeperState and EventType
Date Thu, 11 Sep 2008 02:52:44 GMT

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Jakob Homan updated ZOOKEEPER-139:

    Attachment: ZOOKEEPER-139.patch

The named constants in the EventWatcher for KeeperState and EventType are particularly confusing.
 I've created enums for them, which simplifies and clarifies the client-side code quite a
bit.  As usual, the rub is with Jute and enums.  Since there is no way to use enums in Jute,
I changed the original generated WatcherEvent class to a wrapper for these values, which are
wrapped and unwrapped right before/after transmission from server/client.  The actual new
WatcherEvent class is used in all interactions in the code.  If at some point, a different
serialization protocol is used that supports enums, the wrapper class can be disposed of.

This patch:
   * Creates enums for KeeperState and EventType that were previously named constants in Watcher.java
   * Provides for conversion of these enums to/from integer values for sending over the wire
   * Creates a full-fledged WatcherEvent class.  The previous Jute-generated WatcherEvent
class becomes a wrapper for the enums during transmission.
   * Changes all references to the old named constants to the shiny new enums.
   * Provides unit tests for everything new.

While doing this, I had to resolve ZOOKEEPER-18.  Since it looked like a bug, I eliminated
the KeeperStateChanged value as it doesn't appear anywhere else in the source code.  

Let me know if this looks good.  If so I'll start on converting the permissions.

> Create Enums for WatcherEvent's KeeperState and EventType
> ---------------------------------------------------------
>                 Key: ZOOKEEPER-139
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-139
>             Project: Zookeeper
>          Issue Type: Sub-task
>    Affects Versions: 3.0.0
>            Reporter: Jakob Homan
>            Assignee: Jakob Homan
>             Fix For: 3.0.0
>         Attachments: ZOOKEEPER-139.patch

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

View raw message