dev@grizzly.java.net

Re: Weird code in SelectorThread

From: Justin Lee <Justin.Lee_at_Sun.COM>
Date: Tue, 19 Jan 2010 15:02:00 -0500

Though that return should be broken up into 2 lines. ;)

On 1/18/10 5:45 AM, Oleksiy Stashok wrote:
> Definitely it's a bug, but hope this code is never used. The right way
> to get Selector is to ask context associated SelectorHandler.
>
> Thank you!
>
> WBR,
> Alexey.
>
> On Jan 18, 2010, at 11:37 , Igor Minar wrote:
>
>> Found this odd code in 1.9.18-k:
>>
>> public Selector getSelector(){
>> if (selector != null) {
>> return selector;
>> } else {
>> selectorHandler.getSelector();
>> }
>>
>> return null;
>> }
>>
>>
>> It basically means, if selector is not null return it, otherwise
>> fetch it from selectorHandler but don't store it anywhere, instead
>> return null.
>>
>> Should it be:
>>
>> public Selector getSelector(){
>> if (selector != null) {
>> return selector;
>> } else {
>> return selector = selectorHandler.getSelector();
>> }
>> }
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>