You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Messi Chan <ch...@gmail.com> on 2007/06/30 17:18:13 UTC

some trouble about DemuxingProtocolCodecFactory

Hi, all

I have a doubt about DemuxingProtocolCodecFactory.
I register two MessageEncoders one for class A, and the other for class B.
When my server try to encode A first time, it work fine. But when it try to
encode B next time, I got the exception(unexpected message types ....B). 
Is DemuxingProtocolCodecFactory just allowed register one MessageEncoder? I
want someone's confirmation.

thx a lot :D
-- 
View this message in context: http://www.nabble.com/some-trouble-about-DemuxingProtocolCodecFactory-tf4005109.html#a11374435
Sent from the mina dev mailing list archive at Nabble.com.


Re: some trouble about DemuxingProtocolCodecFactory

Posted by Messi Chan <ch...@gmail.com>.
yes, I made a minor mistake. :(

thx all.
-- 
View this message in context: http://www.nabble.com/some-trouble-about-DemuxingProtocolCodecFactory-tf4005109.html#a11390635
Sent from the mina dev mailing list archive at Nabble.com.


Re: some trouble about DemuxingProtocolCodecFactory

Posted by Trustin Lee <tr...@gmail.com>.
Hi Messi,

On 7/1/07, Messi Chan <ch...@gmail.com> wrote:
>
> Hi, all
>
> I have a doubt about DemuxingProtocolCodecFactory.
> I register two MessageEncoders one for class A, and the other for class B.
> When my server try to encode A first time, it work fine. But when it try to
> encode B next time, I got the exception(unexpected message types ....B).
> Is DemuxingProtocolCodecFactory just allowed register one MessageEncoder? I
> want someone's confirmation.

You can register more than one MessageEncoders, of course.  The
exception message 'unexpected message type' means that no encoder is
registered for the message you attempted to write.

Please make sure your MessageEncoder's getMessageTypes() method is
implemented correctly.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: some trouble about DemuxingProtocolCodecFactory

Posted by Jeroen Brattinga <je...@gmail.com>.
And thank you! I had a similar problem ... which I solved with your 
solution!

Jeroen Brattinga


Messi Chan wrote:
> Hi, Jeroen.
>
> You're right, I have solved the problem.
> I have a AbstractMessageEncoder is super class of A/B Encoder. I have
> defined static field named TYPES used by getMessageTypes() in the
> AbstractMessageEncoder. This is the crux of the problem. Removing it and
> it's work now.
> Thx all of you. :)
>
> ********code*********
> public class AbstractMessageEncoder {
>     
>     public static Set<Class> TYPES;  // should be removed
>     
>     public Set<Class> getMessageTypes() {	
> 	return TYPES;
>     }
> }
>   

Re: some trouble about DemuxingProtocolCodecFactory

Posted by Messi Chan <ch...@gmail.com>.
Hi, Jeroen.

You're right, I have solved the problem.
I have a AbstractMessageEncoder is super class of A/B Encoder. I have
defined getMessageTypes() in the AbstractMessageEncoder. This is the crux of
the problem. Removing it and it's work now.
Thx all of you. :)
-- 
View this message in context: http://www.nabble.com/some-trouble-about-DemuxingProtocolCodecFactory-tf4005109.html#a11388738
Sent from the mina dev mailing list archive at Nabble.com.


Re: some trouble about DemuxingProtocolCodecFactory

Posted by Messi Chan <ch...@gmail.com>.
Hi, Jeroen.

You're right, I have solved the problem.
I have a AbstractMessageEncoder is super class of A/B Encoder. I have
defined static field named TYPES used by getMessageTypes() in the
AbstractMessageEncoder. This is the crux of the problem. Removing it and
it's work now.
Thx all of you. :)

********code*********
public class AbstractMessageEncoder {
    
    public static Set<Class> TYPES;  // should be removed
    
    public Set<Class> getMessageTypes() {	
	return TYPES;
    }
}
-- 
View this message in context: http://www.nabble.com/some-trouble-about-DemuxingProtocolCodecFactory-tf4005109.html#a11388738
Sent from the mina dev mailing list archive at Nabble.com.


Re: some trouble about DemuxingProtocolCodecFactory

Posted by Jeroen Brattinga <je...@gmail.com>.
I don't see what the your link has to do with the 
DemuxingProtocolCodecFactory. AFAIK the Demuxer can be used to encode 
and decode message according to certain message classes.
So it should be perfectly possible to register two different 
MessageEncoders.
If not, then what is the point of the Demuxer?

Jeroen Brattinga


mat wrote:
> http://www.nabble.com/Why-only-one-ProtocolCodecFilter-per-chain-tf3884603.html#a11012504 
>
>
> On 6/30/07, Messi Chan <ch...@gmail.com> wrote:
>>
>>
>> Hi, all
>>
>> I have a doubt about DemuxingProtocolCodecFactory.
>> I register two MessageEncoders one for class A, and the other for 
>> class B.
>> When my server try to encode A first time, it work fine. But when it try
>> to
>> encode B next time, I got the exception(unexpected message types ....B).
>> Is DemuxingProtocolCodecFactory just allowed register one 
>> MessageEncoder?
>> I
>> want someone's confirmation.
>>
>> thx a lot :D
>> -- 
>> View this message in context:
>> http://www.nabble.com/some-trouble-about-DemuxingProtocolCodecFactory-tf4005109.html#a11374435 
>>
>> Sent from the mina dev mailing list archive at Nabble.com.
>>
>>
>

Re: some trouble about DemuxingProtocolCodecFactory

Posted by mat <fo...@gmail.com>.
http://www.nabble.com/Why-only-one-ProtocolCodecFilter-per-chain-tf3884603.html#a11012504

On 6/30/07, Messi Chan <ch...@gmail.com> wrote:
>
>
> Hi, all
>
> I have a doubt about DemuxingProtocolCodecFactory.
> I register two MessageEncoders one for class A, and the other for class B.
> When my server try to encode A first time, it work fine. But when it try
> to
> encode B next time, I got the exception(unexpected message types ....B).
> Is DemuxingProtocolCodecFactory just allowed register one MessageEncoder?
> I
> want someone's confirmation.
>
> thx a lot :D
> --
> View this message in context:
> http://www.nabble.com/some-trouble-about-DemuxingProtocolCodecFactory-tf4005109.html#a11374435
> Sent from the mina dev mailing list archive at Nabble.com.
>
>