[jboss-jira] [JBoss JIRA] (JGRP-1771) Replace Exposed{Input, Output}Stream with ByteArray{Input, Output}Stream

Sanne Grinovero (JIRA) issues at jboss.org
Fri Jan 17 17:52:32 EST 2014


     [ https://issues.jboss.org/browse/JGRP-1771?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sanne Grinovero updated JGRP-1771:
----------------------------------

    Description: 
Currently, when reading a message, we create an ExposedByteArrayInputStream and a DataInputStream on top of it. Then we read the message or message list off of the DataInputStream.
The problem is that DataInputStream creates an 80 byte buffer for every creation, and also an array of 80 chars (additional 160 bytes + array header + pointer).
Same thing for sending a message or message list.

SOLUTION:
* Create a ByteArrayInputStream which implements DataInput and works by reading from the passed in byte array
** Eventually, when switching to NIO.2, use a ByteBufferInputStream which works off of NIO ByteBuffers instead of byte arrays
*** Possibly replace readFrom(DataInput) with readFrom(Buffer) where Buffer implements reading from an NIO ByteBuffer (and possibly also from a simple byte array). Ditto for sending.
* Similar solution for sending of messages / message lists

  was:
Currently, when reading a message, we create an ExposedByteArrayInputStream and a DataInputStream on top of it. Then we read the message or message list off of the DataInputStream.
The problem is that DataInputStream creates an 80 byte buffer for every creation.
Same thing for sending a message or message list.

SOLUTION:
* Create a ByteArrayInputStream which implements DataInput and works by reading from the passed in byte array
** Eventually, when switching to NIO.2, use a ByteBufferInputStream which works off of NIO ByteBuffers instead of byte arrays
*** Possibly replace readFrom(DataInput) with readFrom(Buffer) where Buffer implements reading from an NIO ByteBuffer (and possibly also from a simple byte array). Ditto for sending.
* Similar solution for sending of messages / message lists


    
> Replace Exposed{Input,Output}Stream with ByteArray{Input,Output}Stream
> ----------------------------------------------------------------------
>
>                 Key: JGRP-1771
>                 URL: https://issues.jboss.org/browse/JGRP-1771
>             Project: JGroups
>          Issue Type: Enhancement
>            Reporter: Bela Ban
>            Assignee: Bela Ban
>             Fix For: 3.5
>
>
> Currently, when reading a message, we create an ExposedByteArrayInputStream and a DataInputStream on top of it. Then we read the message or message list off of the DataInputStream.
> The problem is that DataInputStream creates an 80 byte buffer for every creation, and also an array of 80 chars (additional 160 bytes + array header + pointer).
> Same thing for sending a message or message list.
> SOLUTION:
> * Create a ByteArrayInputStream which implements DataInput and works by reading from the passed in byte array
> ** Eventually, when switching to NIO.2, use a ByteBufferInputStream which works off of NIO ByteBuffers instead of byte arrays
> *** Possibly replace readFrom(DataInput) with readFrom(Buffer) where Buffer implements reading from an NIO ByteBuffer (and possibly also from a simple byte array). Ditto for sending.
> * Similar solution for sending of messages / message lists

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list