[jboss-jira] [JBoss JIRA] (JGRP-1773) TP$MyHandler.handleSingleMessage() makes an unnecessary copy of the buffer

Bela Ban (JIRA) issues at jboss.org
Thu Jul 10 10:36:34 EDT 2014


    [ https://issues.jboss.org/browse/JGRP-1773?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12937127#comment-12937127 ] 

Bela Ban edited comment on JGRP-1773 at 7/10/14 10:34 AM:
----------------------------------------------------------

[~sannegrinovero] [~pruivo]: not sure I understand what you meant...
There would be a new {{Message.readFrom()}} method which skips reading the buffer and instead only sets the offset and length of the pass-in buffer.


was (Author: belaban):
[~sannegrinovero] [~pruivo]: not sure I understand what you meant...
There would be a new {{Message.readFrom()} method which skips reading the buffer and instead only sets the offset and length of the pass-in buffer.

> TP$MyHandler.handleSingleMessage() makes an unnecessary copy of the buffer
> --------------------------------------------------------------------------
>
>                 Key: JGRP-1773
>                 URL: https://issues.jboss.org/browse/JGRP-1773
>             Project: JGroups
>          Issue Type: Enhancement
>      Security Level: Public(Everyone can see) 
>            Reporter: Bela Ban
>            Assignee: Bela Ban
>             Fix For: 3.5
>
>
> When a single message is received, we pass it to the thread pool for parsing, passing a copy of the byte array to the MyHandler runnable.
> The parsing then creates a new Message and calls readFrom(). This method reads the headers and then creates a payload buffer of the size read from the input stream, then copies {{size}} bytes from the input stream to the mesage's payload.
> This is an unneeded copy; as we already have a copy of the byte array, we only need to *reference* the byte array from the message and set the offset and length, saving us one copy of the buffer.



--
This message was sent by Atlassian JIRA
(v6.2.6#6264)


More information about the jboss-jira mailing list