mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric Brégier <fred.breg...@free.fr>
Subject proposed patch for ObjectSerializationDecoder and CompressionFilter
Date Tue, 26 Sep 2006 05:54:08 GMT
I would like to propose two patches.

For ObjectSerializationDecoder, except if I badly understood the code,
I don't know why the limit is at 1 MB by default, instead
of Integer.MAX_VALUE ie 2GB.
So if it is ok, I propose to change

    private int maxObjectSize = 1048576; // 1MB
to
    private int maxObjectSize = Integer.MAX_VALUE; // 2GB

For CompressionFilter, again except if I badly understood the code,
I saw that perhaps the in buffer is not released.

In messagedReceived :
Change :

        ByteBuffer inBuffer = ( ByteBuffer ) message;
        ByteBuffer outBuffer = inflater.inflate( inBuffer );

        nextFilter.messageReceived( session, outBuffer );
into
        ByteBuffer inBuffer = ( ByteBuffer ) message;
        ByteBuffer outBuffer = inflater.inflate( inBuffer );
        inBuffer.release();
        nextFilter.messageReceived( session, outBuffer );

In filterWrite :
Change :
        ByteBuffer inBuffer = ( ByteBuffer ) writeRequest.getMessage();

        ByteBuffer outBuf = deflater.deflate( inBuffer );

        nextFilter.filterWrite( session, new WriteRequest( outBuf, 
writeRequest
                .getFuture() ) );
into
        ByteBuffer inBuffer = ( ByteBuffer ) writeRequest.getMessage();

        ByteBuffer outBuf = deflater.deflate( inBuffer );
        inBuffer.release();
        nextFilter.filterWrite( session, new WriteRequest( outBuf, 
writeRequest
                .getFuture() ) );

I used both patch for a while without any problem until now.
Frederic 


Mime
View raw message