activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AMQCPP-371) bytesmessages's size doubled If Message body compression enabled
Date Thu, 05 May 2011 12:47:03 GMT

     [ https://issues.apache.org/jira/browse/AMQCPP-371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Timothy Bish updated AMQCPP-371:
--------------------------------

    Description: 
If the URI option connection.useCompression=true, an ActiveMQBytesMessage's size will always
become doubled. I changed the ActiveMQByteMessage.cpp as follow, the problem seems been solved.

{code}

class ByteCounterOutputStream : public FilterOutputStream {
private:

int* length;

private:

ByteCounterOutputStream( const ByteCounterOutputStream& );
ByteCounterOutputStream operator= ( const ByteCounterOutputStream& );

public:

ByteCounterOutputStream( int* length, OutputStream* stream, bool own = false )
: FilterOutputStream( stream, own ), length( length ) {
}

virtual ~ByteCounterOutputStream() {}

protected:

virtual void doWriteByte( unsigned char value ) {
(*length)++;
FilterOutputStream::doWriteByte( value );
}

virtual void doWriteArray( const unsigned char* buffer, int size ) {

//(*length) += size; removed because of length has been double sized
FilterOutputStream::doWriteArray( buffer, size );
}

virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length
) {

//(*this->length) += length; removed because of length has been double sized
FilterOutputStream::doWriteArrayBounded( buffer, size, offset, length );
}

};

{code}

  was:
If the URI option connection.useCompression=true, an ActiveMQBytesMessage's size will always
become doubled. I changed the ActiveMQByteMessage.cpp as follow, the problem seems been solved.

class ByteCounterOutputStream : public FilterOutputStream {
private:

int* length;

private:

ByteCounterOutputStream( const ByteCounterOutputStream& );
ByteCounterOutputStream operator= ( const ByteCounterOutputStream& );

public:

ByteCounterOutputStream( int* length, OutputStream* stream, bool own = false )
: FilterOutputStream( stream, own ), length( length ) {
}

virtual ~ByteCounterOutputStream() {}

protected:

virtual void doWriteByte( unsigned char value ) {
(*length)++;
FilterOutputStream::doWriteByte( value );
}

virtual void doWriteArray( const unsigned char* buffer, int size ) {

//(*length) += size; removed because of length has been double sized
FilterOutputStream::doWriteArray( buffer, size );
}

virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset, int length
) {

//(*this->length) += length; removed because of length has been double sized
FilterOutputStream::doWriteArrayBounded( buffer, size, offset, length );
}

};


> bytesmessages's size  doubled If Message body compression enabled
> -----------------------------------------------------------------
>
>                 Key: AMQCPP-371
>                 URL: https://issues.apache.org/jira/browse/AMQCPP-371
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: CMS Impl
>    Affects Versions: 3.0, 3.3.0
>         Environment: windows 3.4.0
>            Reporter: 邱承
>            Assignee: Timothy Bish
>
> If the URI option connection.useCompression=true, an ActiveMQBytesMessage's size will
always become doubled. I changed the ActiveMQByteMessage.cpp as follow, the problem seems
been solved.
> {code}
> class ByteCounterOutputStream : public FilterOutputStream {
> private:
> int* length;
> private:
> ByteCounterOutputStream( const ByteCounterOutputStream& );
> ByteCounterOutputStream operator= ( const ByteCounterOutputStream& );
> public:
> ByteCounterOutputStream( int* length, OutputStream* stream, bool own = false )
> : FilterOutputStream( stream, own ), length( length ) {
> }
> virtual ~ByteCounterOutputStream() {}
> protected:
> virtual void doWriteByte( unsigned char value ) {
> (*length)++;
> FilterOutputStream::doWriteByte( value );
> }
> virtual void doWriteArray( const unsigned char* buffer, int size ) {
> //(*length) += size; removed because of length has been double sized
> FilterOutputStream::doWriteArray( buffer, size );
> }
> virtual void doWriteArrayBounded( const unsigned char* buffer, int size, int offset,
int length ) {
> //(*this->length) += length; removed because of length has been double sized
> FilterOutputStream::doWriteArrayBounded( buffer, size, offset, length );
> }
> };
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message