You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by gorano <go...@bskyb.com> on 2007/11/08 12:32:35 UTC
Mina 2 snapshot changes
Hi,
Sorry of being lazy and not figuring this out my self.
(1)
IoSession.getAttachment is now deprecated, do I use the getAttribute with a
key instead?
(2)
DemuxingProtocolCodecFactory.register(...) is gone. Guess I should use
addMessageDecoder and addMessageEncoder instead.
addMessageDecoder takes 2 args though
Inside my MessageEncoder I use stuff like:
public Set<Class<IoBuffer>> getMessageTypes(){
return Collections.<Class<IoBuffer>>singleton(IoBuffer.class);
}
Is this second param replacing this in some way?
cheers
Goran
--
View this message in context: http://www.nabble.com/Mina-2-snapshot-changes-tf4770428s16868.html#a13645417
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
Re: Mina 2 snapshot changes
Posted by Trustin Lee <tr...@gmail.com>.
On Nov 10, 2007 11:01 AM, Mike Heath <mh...@apache.org> wrote:
> Trustin Lee wrote:
> > Thanks Mike!
> >
> > I was actually expecting users to call addMessageEncoder/Decoder multiple times:
> >
> > codec.addMessageEncoder(String.class, SuperMessageEncoder.class);
> > codec.addMessageEncoder(Date.class, SuperMessageEncoder.class);
>
> After putting the change in there, and using it a bit, I'm wondering if
> it wouldn't be better to change the API and specify the encoder and
> first and then the types using the varargs notation. Something like:
>
> addMessageEncoder(Class<? extends MessageEncoder> encoder, Class<?>...
> messageTypes)
>
> That way, could add one or many classes in a single call and it's not as
> tedious as creating and passing in an Iterable.
I thought the same. Please go ahead! :)
Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
Re: Mina 2 snapshot changes
Posted by Mike Heath <mh...@apache.org>.
Trustin Lee wrote:
> Thanks Mike!
>
> I was actually expecting users to call addMessageEncoder/Decoder multiple times:
>
> codec.addMessageEncoder(String.class, SuperMessageEncoder.class);
> codec.addMessageEncoder(Date.class, SuperMessageEncoder.class);
After putting the change in there, and using it a bit, I'm wondering if
it wouldn't be better to change the API and specify the encoder and
first and then the types using the varargs notation. Something like:
addMessageEncoder(Class<? extends MessageEncoder> encoder, Class<?>...
messageTypes)
That way, could add one or many classes in a single call and it's not as
tedious as creating and passing in an Iterable.
WDYT?
-Mike
Re: Mina 2 snapshot changes
Posted by Trustin Lee <tr...@gmail.com>.
Thanks Mike!
I was actually expecting users to call addMessageEncoder/Decoder multiple times:
codec.addMessageEncoder(String.class, SuperMessageEncoder.class);
codec.addMessageEncoder(Date.class, SuperMessageEncoder.class);
Trustin
On Nov 9, 2007 4:58 AM, Mike Heath <mh...@apache.org> wrote:
> I added some additional methods that take a j.u.Collection so you can
> specify multiple types for a single encoder. This appears to be working
> fine for one of my projects.
>
> -Mike
>
>
> gorano wrote:
> > Thanks,
> >
> > It makes sense, but the callback gave me the possibility to return a Set of
> > classes and this method only takes a single Class. Is the callback still
> > there if need comes to specify multiple classes? ..or should a method
> > signature taking a Set also be implemented.
> >
> > I guess I should go to the source and have a look my self (lazy me).
> >
> > Cheers
> >
> > Goran
> >
> >
> > Nicolai_Guba wrote:
> >> gorano <go...@bskyb.com> wrote on 08/11/2007 11:53:00:
> >>
> >>> Yes, it's the first param. Is it replacing the getMessageTypes()
> >> callback
> >>> inside the Message encoder, or does it have another use?
> >> Indeed, it appears that it replaces the callback. Not sure whether it has
> >> other uses...
> >>
> >>> Trustin Lee wrote:
> >>>> On 11/8/07, gorano <go...@bskyb.com> wrote:
> >>>>> Hi,
> >>>>>
> >>>>> Sorry of being lazy and not figuring this out my self.
> >>>>>
> >>>>> (1)
> >>>>>
> >>>>> IoSession.getAttachment is now deprecated, do I use the getAttribute
> >> with
> >>>>> a
> >>>>> key instead?
> >>>> Yes. You could use AttributeKey as a key for the best performance.
> >>>>
> >>>>> (2)
> >>>>>
> >>>>> DemuxingProtocolCodecFactory.register(...) is gone. Guess I should
> >> use
> >>>>> addMessageDecoder and addMessageEncoder instead.
> >>>>>
> >>>>> addMessageDecoder takes 2 args though
> >>>>>
> >>>>> Inside my MessageEncoder I use stuff like:
> >>>>>
> >>>>> public Set<Class<IoBuffer>> getMessageTypes(){
> >>>>> return
> >>>>> Collections.<Class<IoBuffer>>singleton(IoBuffer.class);
> >>>>> }
> >>>>>
> >>>>> Is this second param replacing this in some way?
> >>>> Wasn't it the first param? For example...
> >>>>
> >>>> addMessageEncoder(String.class, StringMessageEncoder.class);
> >>>>
> >>>> HTH,
> >>>> Trustin
> >>>>
> >>>> --
> >>>> what we call human nature is actually human habit
> >>>> --
> >>>> http://gleamynode.net/
> >>>> --
> >>>> PGP Key ID: 0x0255ECA6
> >>>>
> >>>>
> >>> --
> >>> View this message in context: http://www.nabble.com/Mina-2-snapshot-
> >>> changes-tf4770428s16868.html#a13645635
> >>> Sent from the Apache MINA Support Forum mailing list archive at
> >> Nabble.com.
> >>
> >> **********************************************************************
> >> This email and any files transmitted with it are confidential and intended
> >> solely for the use of the individual or entity to whom they are addressed.
> >> If you have received this email in error please notify postmaster@scee.net
> >> This footnote also confirms that this email message has been checked for
> >> all known viruses.
> >> Sony Computer Entertainment Europe Limited
> >> Registered Office: 10 Great Marlborough Street, London W1F 7LP, United
> >> Kingdom
> >> Registered in England: 3277793
> >> **********************************************************************
> >>
> >>
> >
>
>
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6
Re: Mina 2 snapshot changes
Posted by Mike Heath <mh...@apache.org>.
I added some additional methods that take a j.u.Collection so you can
specify multiple types for a single encoder. This appears to be working
fine for one of my projects.
-Mike
gorano wrote:
> Thanks,
>
> It makes sense, but the callback gave me the possibility to return a Set of
> classes and this method only takes a single Class. Is the callback still
> there if need comes to specify multiple classes? ..or should a method
> signature taking a Set also be implemented.
>
> I guess I should go to the source and have a look my self (lazy me).
>
> Cheers
>
> Goran
>
>
> Nicolai_Guba wrote:
>> gorano <go...@bskyb.com> wrote on 08/11/2007 11:53:00:
>>
>>> Yes, it's the first param. Is it replacing the getMessageTypes()
>> callback
>>> inside the Message encoder, or does it have another use?
>> Indeed, it appears that it replaces the callback. Not sure whether it has
>> other uses...
>>
>>> Trustin Lee wrote:
>>>> On 11/8/07, gorano <go...@bskyb.com> wrote:
>>>>> Hi,
>>>>>
>>>>> Sorry of being lazy and not figuring this out my self.
>>>>>
>>>>> (1)
>>>>>
>>>>> IoSession.getAttachment is now deprecated, do I use the getAttribute
>> with
>>>>> a
>>>>> key instead?
>>>> Yes. You could use AttributeKey as a key for the best performance.
>>>>
>>>>> (2)
>>>>>
>>>>> DemuxingProtocolCodecFactory.register(...) is gone. Guess I should
>> use
>>>>> addMessageDecoder and addMessageEncoder instead.
>>>>>
>>>>> addMessageDecoder takes 2 args though
>>>>>
>>>>> Inside my MessageEncoder I use stuff like:
>>>>>
>>>>> public Set<Class<IoBuffer>> getMessageTypes(){
>>>>> return
>>>>> Collections.<Class<IoBuffer>>singleton(IoBuffer.class);
>>>>> }
>>>>>
>>>>> Is this second param replacing this in some way?
>>>> Wasn't it the first param? For example...
>>>>
>>>> addMessageEncoder(String.class, StringMessageEncoder.class);
>>>>
>>>> HTH,
>>>> Trustin
>>>>
>>>> --
>>>> what we call human nature is actually human habit
>>>> --
>>>> http://gleamynode.net/
>>>> --
>>>> PGP Key ID: 0x0255ECA6
>>>>
>>>>
>>> --
>>> View this message in context: http://www.nabble.com/Mina-2-snapshot-
>>> changes-tf4770428s16868.html#a13645635
>>> Sent from the Apache MINA Support Forum mailing list archive at
>> Nabble.com.
>>
>> **********************************************************************
>> This email and any files transmitted with it are confidential and intended
>> solely for the use of the individual or entity to whom they are addressed.
>> If you have received this email in error please notify postmaster@scee.net
>> This footnote also confirms that this email message has been checked for
>> all known viruses.
>> Sony Computer Entertainment Europe Limited
>> Registered Office: 10 Great Marlborough Street, London W1F 7LP, United
>> Kingdom
>> Registered in England: 3277793
>> **********************************************************************
>>
>>
>
Re: Mina 2 snapshot changes
Posted by gorano <go...@bskyb.com>.
Thanks,
It makes sense, but the callback gave me the possibility to return a Set of
classes and this method only takes a single Class. Is the callback still
there if need comes to specify multiple classes? ..or should a method
signature taking a Set also be implemented.
I guess I should go to the source and have a look my self (lazy me).
Cheers
Goran
Nicolai_Guba wrote:
>
> gorano <go...@bskyb.com> wrote on 08/11/2007 11:53:00:
>
>>
>> Yes, it's the first param. Is it replacing the getMessageTypes()
> callback
>> inside the Message encoder, or does it have another use?
>
> Indeed, it appears that it replaces the callback. Not sure whether it has
> other uses...
>
>>
>> Trustin Lee wrote:
>> >
>> > On 11/8/07, gorano <go...@bskyb.com> wrote:
>> >>
>> >> Hi,
>> >>
>> >> Sorry of being lazy and not figuring this out my self.
>> >>
>> >> (1)
>> >>
>> >> IoSession.getAttachment is now deprecated, do I use the getAttribute
> with
>> >> a
>> >> key instead?
>> >
>> > Yes. You could use AttributeKey as a key for the best performance.
>> >
>> >> (2)
>> >>
>> >> DemuxingProtocolCodecFactory.register(...) is gone. Guess I should
> use
>> >> addMessageDecoder and addMessageEncoder instead.
>> >>
>> >> addMessageDecoder takes 2 args though
>> >>
>> >> Inside my MessageEncoder I use stuff like:
>> >>
>> >> public Set<Class<IoBuffer>> getMessageTypes(){
>> >> return
>> >> Collections.<Class<IoBuffer>>singleton(IoBuffer.class);
>> >> }
>> >>
>> >> Is this second param replacing this in some way?
>> >
>> > Wasn't it the first param? For example...
>> >
>> > addMessageEncoder(String.class, StringMessageEncoder.class);
>> >
>> > HTH,
>> > Trustin
>> >
>> > --
>> > what we call human nature is actually human habit
>> > --
>> > http://gleamynode.net/
>> > --
>> > PGP Key ID: 0x0255ECA6
>> >
>> >
>>
>> --
>> View this message in context: http://www.nabble.com/Mina-2-snapshot-
>> changes-tf4770428s16868.html#a13645635
>> Sent from the Apache MINA Support Forum mailing list archive at
> Nabble.com.
>>
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify postmaster@scee.net
> This footnote also confirms that this email message has been checked for
> all known viruses.
> Sony Computer Entertainment Europe Limited
> Registered Office: 10 Great Marlborough Street, London W1F 7LP, United
> Kingdom
> Registered in England: 3277793
> **********************************************************************
>
>
--
View this message in context: http://www.nabble.com/Mina-2-snapshot-changes-tf4770428s16868.html#a13646942
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
Re: Mina 2 snapshot changes
Posted by Ni...@scee.net.
gorano <go...@bskyb.com> wrote on 08/11/2007 11:53:00:
>
> Yes, it's the first param. Is it replacing the getMessageTypes()
callback
> inside the Message encoder, or does it have another use?
Indeed, it appears that it replaces the callback. Not sure whether it has
other uses...
>
> Trustin Lee wrote:
> >
> > On 11/8/07, gorano <go...@bskyb.com> wrote:
> >>
> >> Hi,
> >>
> >> Sorry of being lazy and not figuring this out my self.
> >>
> >> (1)
> >>
> >> IoSession.getAttachment is now deprecated, do I use the getAttribute
with
> >> a
> >> key instead?
> >
> > Yes. You could use AttributeKey as a key for the best performance.
> >
> >> (2)
> >>
> >> DemuxingProtocolCodecFactory.register(...) is gone. Guess I should
use
> >> addMessageDecoder and addMessageEncoder instead.
> >>
> >> addMessageDecoder takes 2 args though
> >>
> >> Inside my MessageEncoder I use stuff like:
> >>
> >> public Set<Class<IoBuffer>> getMessageTypes(){
> >> return
> >> Collections.<Class<IoBuffer>>singleton(IoBuffer.class);
> >> }
> >>
> >> Is this second param replacing this in some way?
> >
> > Wasn't it the first param? For example...
> >
> > addMessageEncoder(String.class, StringMessageEncoder.class);
> >
> > HTH,
> > Trustin
> >
> > --
> > what we call human nature is actually human habit
> > --
> > http://gleamynode.net/
> > --
> > PGP Key ID: 0x0255ECA6
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Mina-2-snapshot-
> changes-tf4770428s16868.html#a13645635
> Sent from the Apache MINA Support Forum mailing list archive at
Nabble.com.
>
**********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify postmaster@scee.net
This footnote also confirms that this email message has been checked for all known viruses.
Sony Computer Entertainment Europe Limited
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United Kingdom
Registered in England: 3277793
**********************************************************************
Re: Mina 2 snapshot changes
Posted by gorano <go...@bskyb.com>.
Yes, it's the first param. Is it replacing the getMessageTypes() callback
inside the Message encoder, or does it have another use?
G
Trustin Lee wrote:
>
> On 11/8/07, gorano <go...@bskyb.com> wrote:
>>
>> Hi,
>>
>> Sorry of being lazy and not figuring this out my self.
>>
>> (1)
>>
>> IoSession.getAttachment is now deprecated, do I use the getAttribute with
>> a
>> key instead?
>
> Yes. You could use AttributeKey as a key for the best performance.
>
>> (2)
>>
>> DemuxingProtocolCodecFactory.register(...) is gone. Guess I should use
>> addMessageDecoder and addMessageEncoder instead.
>>
>> addMessageDecoder takes 2 args though
>>
>> Inside my MessageEncoder I use stuff like:
>>
>> public Set<Class<IoBuffer>> getMessageTypes(){
>> return
>> Collections.<Class<IoBuffer>>singleton(IoBuffer.class);
>> }
>>
>> Is this second param replacing this in some way?
>
> Wasn't it the first param? For example...
>
> addMessageEncoder(String.class, StringMessageEncoder.class);
>
> HTH,
> Trustin
>
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>
>
--
View this message in context: http://www.nabble.com/Mina-2-snapshot-changes-tf4770428s16868.html#a13645635
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.
Re: Mina 2 snapshot changes
Posted by Trustin Lee <tr...@gmail.com>.
On 11/8/07, gorano <go...@bskyb.com> wrote:
>
> Hi,
>
> Sorry of being lazy and not figuring this out my self.
>
> (1)
>
> IoSession.getAttachment is now deprecated, do I use the getAttribute with a
> key instead?
Yes. You could use AttributeKey as a key for the best performance.
> (2)
>
> DemuxingProtocolCodecFactory.register(...) is gone. Guess I should use
> addMessageDecoder and addMessageEncoder instead.
>
> addMessageDecoder takes 2 args though
>
> Inside my MessageEncoder I use stuff like:
>
> public Set<Class<IoBuffer>> getMessageTypes(){
> return Collections.<Class<IoBuffer>>singleton(IoBuffer.class);
> }
>
> Is this second param replacing this in some way?
Wasn't it the first param? For example...
addMessageEncoder(String.class, StringMessageEncoder.class);
HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6