You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by John Fallows <jo...@kaazing.com> on 2010/03/14 01:03:00 UTC
ProtocolCodecFilter change of behavior in 2.0.0-RC1
Folks,
There appears to be a change of behavior in ProtocolCodeFilter due to the
previously non-static and now-static nature of the attribute keys used to
cache the encoder, encoder output, decoder and decoder output.
Specifically, the pre-2.0.0-RC1 code
private final AttributeKey ENCODER = new
AttributeKey(ProtocolCodecFilter.class, "encoder");
private final AttributeKey DECODER = new
AttributeKey(ProtocolCodecFilter.class, "decoder");
private final AttributeKey DECODER_OUT = new
AttributeKey(ProtocolCodecFilter.class, "decoderOut");
private final AttributeKey ENCODER_OUT = new
AttributeKey(ProtocolCodecFilter.class, "encoderOut");
has been changed to
private static final AttributeKey ENCODER = new
AttributeKey(ProtocolCodecFilter.class, "encoder");
private static final AttributeKey DECODER = new
AttributeKey(ProtocolCodecFilter.class, "decoder");
private static final AttributeKey DECODER_OUT = new
AttributeKey(ProtocolCodecFilter.class, "decoderOut");
private static final AttributeKey ENCODER_OUT = new
AttributeKey(ProtocolCodecFilter.class, "encoderOut");
This change now prevents two different ProtocolCodecFilters from operating
on the same IoSession because of the following:
private ProtocolEncoderOutput getEncoderOut(IoSession session,
NextFilter nextFilter, WriteRequest writeRequest) {
ProtocolEncoderOutput out = (ProtocolEncoderOutput)
session.getAttribute(ENCODER_OUT);
if (out == null) {
// Create a new instance, and stores it into the session
out = new ProtocolEncoderOutputImpl(session, nextFilter,
writeRequest);
session.setAttribute(ENCODER_OUT, out);
}
return out;
}
When a second instance of ProtocolCodecFilter attempts to retrieve its
encoder output for the first time, then it finds the shared instance cached
in the session by the first ProtocolCodecFilter, under the same static
attribute key. When the attribute keys were non-static, then the second
ProtocolCodecFilter's behavior was isolated from the first, as desired.
Typically, filter instances are created in advance, and reused for all
sessions, so there does not seem to be any practical advantage in having
these attribute keys static.
Is there any objection to reverting these 4 attribute key constants to
non-static for 2.0.0 final?
Kind Regards,
John Fallows
--
>|< Kaazing Corporation >|<
John Fallows | CTO | +1.650.960.8148
888 Villa St, Ste 410 | Mountain View, CA 94041, USA
Re: ProtocolCodecFilter change of behavior in 2.0.0-RC1
Posted by Ashish <pa...@gmail.com>.
On Sun, Mar 14, 2010 at 9:38 AM, John Fallows <jo...@kaazing.com> wrote:
> Thanks Emmanuel.
>
> Good to see you were already on top of this six months ago! Sorry that I
> didn't consider checking the trunk.
>
> Is there any word on when we might expect a post 2.0.0-RC1 release, either
> 2.0.0-RC2 or 2.0.0 final?
We are working on this. Hopefully, it shall be soon :)
>
> Kind Regards
> John Fallows
>
>
> On Mar 13, 2010, at 5:58 PM, Emmanuel Lecharny <el...@gmail.com> wrote:
>
>> On 3/14/10 1:03 AM, John Fallows wrote:
>>>
>>> Folks,
>>>
>>> There appears to be a change of behavior in ProtocolCodeFilter due to the
>>> previously non-static and now-static nature of the attribute keys used to
>>> cache the encoder, encoder output, decoder and decoder output.
>>>
>> <snip/>
>>>
>>> Is there any objection to reverting these 4 attribute key constants to
>>> non-static for 2.0.0 final?
>>>
>> This was a mistake I did a few months ago. It has been reverted in
>> revision 580762, back in september 2009.
>>
>>
>> --
>> Regards,
>> Cordialement,
>> Emmanuel Lécharny
>> www.nextury.com
>>
>>
>
--
thanks
ashish
Blog: http://www.ashishpaliwal.com/blog
My Photo Galleries: http://www.pbase.com/ashishpaliwal
Re: ProtocolCodecFilter change of behavior in 2.0.0-RC1
Posted by John Fallows <jo...@kaazing.com>.
Thanks Emmanuel.
Good to see you were already on top of this six months ago! Sorry
that I didn't consider checking the trunk.
Is there any word on when we might expect a post 2.0.0-RC1 release,
either 2.0.0-RC2 or 2.0.0 final?
Kind Regards
John Fallows
On Mar 13, 2010, at 5:58 PM, Emmanuel Lecharny <el...@gmail.com>
wrote:
> On 3/14/10 1:03 AM, John Fallows wrote:
>> Folks,
>>
>> There appears to be a change of behavior in ProtocolCodeFilter due
>> to the
>> previously non-static and now-static nature of the attribute keys
>> used to
>> cache the encoder, encoder output, decoder and decoder output.
>>
> <snip/>
>> Is there any objection to reverting these 4 attribute key constants
>> to
>> non-static for 2.0.0 final?
>>
> This was a mistake I did a few months ago. It has been reverted in
> revision 580762, back in september 2009.
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.nextury.com
>
>
Re: ProtocolCodecFilter change of behavior in 2.0.0-RC1
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 3/14/10 1:03 AM, John Fallows wrote:
> Folks,
>
> There appears to be a change of behavior in ProtocolCodeFilter due to the
> previously non-static and now-static nature of the attribute keys used to
> cache the encoder, encoder output, decoder and decoder output.
>
<snip/>
> Is there any objection to reverting these 4 attribute key constants to
> non-static for 2.0.0 final?
>
This was a mistake I did a few months ago. It has been reverted in
revision 580762, back in september 2009.
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com