[ 
http://issues.apache.org/jira/browse/DIRMINA-201?page=comments#action_12373183 
] 

Robert Greig commented on DIRMINA-201:
--------------------------------------

That is a very interesting observation about ProtocolCodecFilter not passing 
the messages on immediately. I agree it would make sense to pass the decoded 
message on immediately.

However I think the changes to CPD would make sense even if the SPDO were to be 
refactored as you suggest. On the client side, the buffer slice could certainly 
be held for longer (in our application we have a client which wraps the slice 
in an object exposed in a user-level API), which means that reusing a buffer 
within CPD causes problems. Also changing CPD and SocketIoProcessor to avoid 
copying should increase throughput.

You can also imagine on the server-side some protocol that might need to keep 
hold of a slice until a subsequent message arrives (with other messages 
arriving in the meantime on the same session), and that would be corrupted if 
the underlying buffer is reused.

> Make the CumulativeProtocolDecoder "slice compatible"
> -----------------------------------------------------
>
>          Key: DIRMINA-201
>          URL: http://issues.apache.org/jira/browse/DIRMINA-201
>      Project: Directory MINA
>         Type: Improvement

>     Versions: 0.9.3
>     Reporter: Robert Greig
>  Attachments: CumulativeProtocolDecoder.java, CumulativeProtocolDecoder.java, 
> CumulativeProtocolDecoder.java.diff, SocketIoProcessor.java, 
> SocketIoProcessor.java.diff
>
> There is a problem with using slice() along with the 
> CumulativeProtocolDecoder. 
> The problem is that the CPD does a compact() when it has completed the 
> attempt to decode the buffer, and then reuses the buffer.
> If your decoder expects to be able to take a slice() of the buffer and use 
> that it will find the data gets corrupted by the next call to the 
> CumulativeProtocolDecoder.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to