Overlaping messages
Ernesto A.
eaneiros at gmail.com
Mon Jul 6 13:33:46 EDT 2009
Thanks Christian for your answer, the problem is solved now, following
your advise I added a FrameDecoder to tokenize the input before
passing it to the StringDecoder, I had to do some minor modifications
to the DelimiterBasedFrameDecoder class as my application demands a
variable
length delimiter but everything is working ok. Thanks again, ernesto.
On Mon, Jul 6, 2009 at 3:22 AM, "이희승 (Trustin Lee)"<trustin at gmail.com> wrote:
> Thanks, Christian for a great answer. :)
>
> Cheers,
> Trustin
>
> On 07/03/2009 03:25 PM, Christian Migowski wrote:
>> Hi Ernesto,
>>
>> from the information given so far, I would say it just coincidentaly
>> works fine when you only use the StringDecoder. As the Javadoc for
>> StringDecoder and OneToOneDecoder say, you have to use some kind of
>> FrameDecoder before using this decoder because the network input
>> stream must be "tokenized" into message units first.
>>
>> hth,
>> regards,
>> christian
>>
>> On Thu, Jul 2, 2009 at 10:20 PM, Ernesto A.<eaneiros at gmail.com> wrote:
>>> Hi,
>>>
>>> I'm playing around with netty to see if we can use it to replace our
>>> old network framework, based on its flexibility and the promise of
>>> switching to nio with minimal effort should we need it. So far I have
>>> encountered only one problem: we use a simple text protocol to
>>> communicate between client and server, it consists of text fields
>>> separated by a separator, we have the following setup for the channel
>>> factory
>>>
>>> ...ChannelFactory:
>>> pipeline.addLast("string_decoder", new StringDecoder());
>>> pipeline.addLast("object_decoder", new OurObjectDecoder());
>>>
>>> OurObjectDecoder class extends OneToOneDecoder, takes a string message
>>> and parses it to produce a POJO. So far so good, but sometimes, not
>>> always, a message would overlap over a previous message at the same
>>> position always, and we end up receiving two messages in one, and
>>> consequently failing to register and losing the second message.
>>> However when I take my object decoder out of the pipeline chain and
>>> handle the message directly on my business logic then I get the
>>> messages one after the other without overlaping. Could it be two
>>> internal netty threads modifying the ChannelBuffer concurrently? I'm
>>> using netty 3.1.0.cr1, any feedback would be appreciated, thanks in
>>> advance, Ernest.
>>> _______________________________________________
>>> netty-users mailing list
>>> netty-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
More information about the netty-users
mailing list