dev@grizzly.java.net

Re: Safe way to stop controller?

From: charlie hunt <charlie.hunt_at_sun.com>
Date: Mon, 16 Apr 2007 11:12:13 -0500

Since we didn't have an (external) project on java.net at the time, we
started work on an internal (Sun) server. At some point we'll probably
put this code out on java.net as we get closer to starting V2 work.

Here's the internal svn repository link:
http://kohsuke.sfbay.sun.com/svn/repos/grizzlyv2/

As I mentioned this repository is not available external to Sun :-(

I've included the file here ... actually we didn't call it a
SelectorImpl. It's a TransportDispatcherImpl.

charlie ...

Oleksiy Stashok wrote:
> Where I can find Grizzly V2 code?
>
> Thanks.
> Alexey.
>
> charlie hunt wrote:
>> 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
>>>
>>
>> ---------------------------------------------------------------------
>> 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/>