[infinispan-issues] [JBoss JIRA] Resolved: (ISPN-393) Override decodeLast instead of checking readableBytes

Galder Zamarreno (JIRA) jira-events at lists.jboss.org
Wed Apr 7 09:46:38 EDT 2010


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

Galder Zamarreno resolved ISPN-393.
-----------------------------------

    Resolution: Done


> Override decodeLast instead of checking readableBytes
> -----------------------------------------------------
>
>                 Key: ISPN-393
>                 URL: https://jira.jboss.org/jira/browse/ISPN-393
>             Project: Infinispan
>          Issue Type: Task
>          Components: Cache Server
>    Affects Versions: 4.1.0.ALPHA2
>            Reporter: Galder Zamarreno
>            Assignee: Galder Zamarreno
>             Fix For: 4.1.0.BETA1
>
>
> Replace readableBytes hack when clients disconnect from the channel with implementing decodeLast accordingly. See below for more details
> <galderz> one final thing,
> <galderz> one thing I've spotted is that when a clients disconnect
> <trustin> (overriden that is)
> <galderz> my ReplayingDecoder.decode is called with nothing to read
> <galderz> iow, trying to read a byte throws a rather noisy ChannelClosedException or something like that
> <galderz> so, to get around this,
> <galderz> i created in the netty ChannelBufferAdapter that we have
> <galderz> i created a method called readableBytes that computes
> <galderz> buffer.writerIndex - buffer.readerIndex
> <trustin> hmmm
> <trustin> actually, ReplayingDecoder calls its decodeLast() method when the connection is closed.
> <galderz> calling buffer,readableBytes  in the ReplayingDecoder would not really tell me what's behing
> <trustin> but the default implementation of decodeLast() is delegate the call to decode();.
> <galderz> right, so maybe I need to override decodeLast?
> <galderz> what I'm doing right now looks v hacky
> <trustin> yeah if you do not want to be notified when the connection is closed in your decoder
> <trustin> just override decodeLast() an do nothing there.
> <galderz> right, i'll check that out as well
> <trustin> The default decodeLast() implementation is reasonable with FrameDecoder, but I guess it seems to confuse the user with ReplayingDecoder
> * manik has quit (Quit: manik)
> <galderz> i think so, cos readableBytes gives me Integer.Max in those situations
> <trustin> when disconnected
> <trustin> readableBytes() will give the actual readable bytes
> <galderz> yeah, when disconnected
> <trustin> instead of Integer.MAX
> <galderz> it was definitely not giving me 0
> <galderz> it was giving something really big
> <trustin> oh I see.
> <trustin> Let me know if you still have to problem after overriding decodeLast()
> <trustin> to -> the
> <galderz> sure, thanks a million for this chat

-- 
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

        


More information about the infinispan-issues mailing list