You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "David Mollitor (JIRA)" <ji...@apache.org> on 2019/03/28 21:05:00 UTC
[jira] [Updated] (ZOOKEEPER-3341) Remove Superfluous ByteBuffer
Duplicate
[ https://issues.apache.org/jira/browse/ZOOKEEPER-3341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Mollitor updated ZOOKEEPER-3341:
--------------------------------------
Summary: Remove Superfluous ByteBuffer Duplicate (was: Superfluous ByteBuffer Duplicate)
> 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
> Priority: Trivial
>
> {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)