Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-2194

Let DataNode.getChildren() return an unmodifiable view of its children set

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.4.6, 3.5.0
    • Fix Version/s: 3.4.7, 3.5.1, 3.6.0
    • Component/s: server
    • Labels:
      None
    • Flags:
      Patch

      Description

      Current DataNode.getChildren() directly returns a pointer of its private member, children. However, the member should be modified through addChild() and removeChild(). Callers of getChildren() shouldn't modify it directly.

      For preventing the direct modification by the callers, this patch lets getChildren() return an unmodifiable view of its children set. If the callers try to modify directly, runtime exception will be risen.

        Attachments

        1. ZOOKEEPER-2194.patch
          0.9 kB
          Hitoshi Mitake
        2. ZOOKEEPER-2194-v2.patch
          0.9 kB
          Hitoshi Mitake

          Activity

            People

            • Assignee:
              mitake Hitoshi Mitake
              Reporter:
              mitake Hitoshi Mitake
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: