zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andor Molnar (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (ZOOKEEPER-3341) Remove Superfluous ByteBuffer Duplicate
Date Tue, 09 Apr 2019 14:09:00 GMT

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

Andor Molnar resolved ZOOKEEPER-3341.
-------------------------------------
       Resolution: Fixed
    Fix Version/s:     (was: 3.5.6)

Issue resolved by pull request 881
[https://github.com/apache/zookeeper/pull/881]

> Remove Superfluous ByteBuffer Duplicate
> ---------------------------------------
>
>                 Key: ZOOKEEPER-3341
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3341
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Trivial
>              Labels: pull-request-available
>             Fix For: 3.6.0
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> {code:java|title=QuorumCnxManager.java}
>   byte[] msgArray = new byte[length];
>   din.readFully(msgArray, 0, length);
>   ByteBuffer message = ByteBuffer.wrap(msgArray);
>   addToRecvQueue(new Message(message.duplicate(), sid));
> {code}
> The {{message}} is being duplicated and the original is GC'ed.  Just pass the {{message}};
do not bother with making a duplicate.  I think this is a copy+paste bug.
> https://github.com/apache/zookeeper/blob/master/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/QuorumCnxManager.java#L1195-L1198



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message