[
https://jira.jboss.org/jira/browse/JGRP-796?page=com.atlassian.jira.plugi...
]
Bela Ban commented on JGRP-796:
-------------------------------
Actually, this *is* useful when the underlying byte[] buffer is NOT reused, e.g.
ExposedByteArrayOutputStream output=new ExposedByteArrayOutputStream(512);
DataOutputStream out=new DataOutputStream(output);
out.writeBoolean(msg != null);
if(msg != null)
msg.writeTo(out);
out.flush();
Buffer retval=new Buffer(output.getRawBuffer(), 0, output.size());
out.close();
output.close();
Message xmit_msg=new Message(dest, null, buf.getBuf(), buf.getOffset(),
buf.getLength());
xmit_msg.putHeader(name, new NakAckHeader(NakAckHeader.XMIT_RSP, seqno));
down_prot.down(new Event(Event.MSG, xmit_msg));
In this case, we avoid copying the byte[] buffer by calling
ByteArrayOutputStream.toByteArray() and using an ExposedByteArrayOutputStream.
BUT: we need to be guaranteed by the caller that he won't change the underlying byte[]
buffer EVER !
RpcDispatcher.Marshaller: use Buffer instead of byte[]
------------------------------------------------------
Key: JGRP-796
URL:
https://jira.jboss.org/jira/browse/JGRP-796
Project: JGroups
Issue Type: Task
Reporter: Bela Ban
Assignee: Bela Ban
Priority: Minor
Fix For: 2.7
A Buffer allows us to pass in byte[] arrays with a different offset and length; more
flexible. Maybe create a Marshaller2 (extending Marshaller)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira