[
https://issues.apache.org/jira/browse/ARTEMIS-3459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17409615#comment-17409615
]
ASF subversion and git services commented on ARTEMIS-3459:
----------------------------------------------------------
Commit 9b074e124ee5d5aaa1e01130f3119a4efb230afb in activemq-artemis's branch
refs/heads/main from Robbie Gemmell
[ https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=9b074e1 ]
ARTEMIS-3459: use appropriate call to clear up, avoid creating unnecessary
wrapper
> AMQPMessage.scanMessageData() creates unecessary buffer wrapper
> ---------------------------------------------------------------
>
> Key: ARTEMIS-3459
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3459
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Affects Versions: 2.18.0
> Reporter: Robbie Gemmell
> Assignee: Robbie Gemmell
> Priority: Trivial
> Fix For: 2.19.0
>
>
> The AMQPMessage.scanMessageData(ReadableBuffer) method creates an unecessary
> buffer wrapper on every decode. The method has the equivalent of:
> {code}
> decoder.setBuffer(data);
> try {
> //...use decoder..
> } finally {
> decoder.setByteBuffer(null);
> }
> {code}
> Effectively it tries to use the thread-local decoder, then ensure the related
> buffer is discarded after.
> However the two setter uses are different, with the former taking the
> ReadableBuffer directly, and the latter method expected to be passed a
> ByteBuffer, which causes creation of a ReadableBuffer wrapper for it. By
> passing it null with that method, a needless wrapper object is created. One
> which is discarded on the next decode by that thread when it sets the next
> actual buffer. It should be using setBuffer(null).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)