From notifications-return-228-archive-asf-public=cust-asf.ponee.io@zookeeper.apache.org Thu Jun 13 00:57:47 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 09C7518067E for ; Thu, 13 Jun 2019 02:57:46 +0200 (CEST) Received: (qmail 8475 invoked by uid 500); 13 Jun 2019 00:57:46 -0000 Mailing-List: contact notifications-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list notifications@zookeeper.apache.org Received: (qmail 8454 invoked by uid 99); 13 Jun 2019 00:57:46 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jun 2019 00:57:46 +0000 From: GitBox To: notifications@zookeeper.apache.org Subject: [GitHub] [zookeeper] stickyhipp commented on a change in pull request #959: ZOOKEEPER-3402: Add multiRead operation Message-ID: <156038746644.21140.7272874706664889807.gitbox@gitbox.apache.org> Date: Thu, 13 Jun 2019 00:57:46 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit stickyhipp commented on a change in pull request #959: ZOOKEEPER-3402: Add multiRead operation URL: https://github.com/apache/zookeeper/pull/959#discussion_r293170680 ########## File path: zookeeper-server/src/main/java/org/apache/zookeeper/OpResult.java ########## @@ -170,6 +173,67 @@ public int hashCode() { } } + /** + * A result from a getChildren operation. Provides a list which contains + * the names of the children of a given node. + */ + public static class GetChildrenResult extends OpResult { + private List children; + + public GetChildrenResult(List children) { + super(ZooDefs.OpCode.getChildren); + this.children = children; + } + + public List getChildren() { + return children; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof GetChildrenResult)) return false; + + GetChildrenResult other = (GetChildrenResult) o; + return getType() == other.getType() && children.equals(other.children); + } + + @Override + public int hashCode() { + return getType() * 35 + children.hashCode(); + } + } + + /** + * A result from a getData operation. The data is represented as a byte array. + */ + public static class GetDataResult extends OpResult { + private byte[] data; + + public GetDataResult(byte[] data) { + super(ZooDefs.OpCode.getData); + this.data = data.clone(); Review comment: Consider Arrays.copyOf() instead of clone()? clone feels antiquated to me, but I'm not clear what the best practice is... Check for null on data? this.data = (data == null ? null : Arrays.copyOf(data, data.length)); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services