dev@grizzly.java.net

Re: Safe way to stop controller?

From: charlie hunt <charlie.hunt_at_sun.com>
Date: Mon, 16 Apr 2007 10:40:10 -0500

Don't mean to hijack the conversation here :-/

It might be worth a look at what we had implemented in our first attempt
at Grizzly V2 ?

IIRC, I think the Controller is very similar to what we had called a
SelectorImpl ?

charlie ...

Oleksiy Stashok wrote:
>
>
> Jeanfrancois Arcand wrote:
>> Hi Alexey,
>>
>> Oleksiy Stashok wrote:
>>> Hi,
>>>
>>> I'd like to ask, what is the safe way to stop controller?
>>> As if it's started in some thread and I try to stop it from
>>> different one calling controller.stop() - then controller's working
>>> thread is starting to throw exceptions [1]...
>>> Am I doing something wrong? Or it's a bug?
>> I don't think you are doing something wrong....I don't know if there
>> is a good way of stopping a controller. In Grizzly 1.0, I was first
>> cycling over all the SelectionKey, cancelling them. I suspect we need
>> to do something like that as well to avoid Selector.select()...Do you
>> have time to take a look?
> Yes, I will look there.
>
> I saw key canceling cycle, but seems it also has an issue, as it's
> possible for key's channel to be *Server*SocketChannel, which leads to
> ClassCastException.
>
> WBR,
> Alexey.
>>
>> Thanks
>>
>> -- Jeanfrancois
>>
>>
>>
>>
>>>
>>> Thanks.
>>>
>>> WBR,
>>> Alexey.
>>>
>>> [1] java.nio.channels.ClosedSelectorException
>>> at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:66)
>>> at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
>>> at
>>> com.sun.grizzly.TCPSelectorHandler.select(TCPSelectorHandler.java:221)
>>> at com.sun.grizzly.Controller.doSelect(Controller.java:186)
>>> at com.sun.grizzly.Controller.start(Controller.java:364)
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>

-- 
Charlie Hunt
Java Performance Engineer
630.285.7708 x47708 (Internal)
<http://java.sun.com/docs/performance/>