Shutdown of Server Channel Factory
Thomas Bocek
bocek at ifi.uzh.ch
Wed Sep 9 15:33:02 EDT 2009
Hi Michael,
Hmm, it should work like this. I have attached a small app that opens a
channel, closes it and releases resources. The last two lines are:
server.close().awaitUninterruptibly();
cfServer.releaseExternalResources();
Can you try to see what the difference is between the attached and your
code?
Thomas
Michael McGrady wrote:
> Hi, Thomas,
>
> I tried a slight modification in logging and got the same result as
> before. Also, I know the close operation finishes because it shows as
> finished and the channel connection as closed. At least I think I know
> that. Do you think otherwise? Thanks, again, for the help.
>
>
>
> public void stop() {
> this.channel.close().awaitUninterruptibly();
> logger.log(InternalLogLevel.INFO, this.getClass().getSimpleName()
> + " start stop");
> NettyKarmaReceiver.this.factory.releaseExternalResources();
> logger.log(InternalLogLevel.INFO, this.getClass().getSimpleName()
> + " end stop");
> }
>
> On Sep 9, 2009, at 10:44 AM, Thomas Bocek wrote:
>
>> Michael, try this one:
>>
>> public void stop() {
>> logger.log(InternalLogLevel.INFO, this.getClass().getSimpleName()
>> + " start stop");
>> this.channel.close().awaitUninterruptibly();
>> NettyKarmaReceiver.this.factory.releaseExternalResources();
>> logger.log(InternalLogLevel.INFO, this.getClass().getSimpleName()
>> + " end stop");
>> }
>>
>> If you block in the Netty thread, then the close operation is never
>> finished, and the terminate() call is in an endless loop, resulting in a
>> deadlock. Either you do it outside the Netty thread as above, or you
>> create a new Thread and run it there.
>>
>> Thomas
>>
>> Michael McGrady wrote:
>>> Thanks, Thomas. The following is the code I am using and in this test
>>> there is no other connection than the one.
>>>
>>>
>>>
>>> public void stop() {
>>> logger.log(InternalLogLevel.INFO, this.getClass().getSimpleName()
>>> + " start stop");
>>> ChannelFuture close = this.channel.close();
>>>
>>> close.addListener(new ChannelFutureListener() {
>>>
>>> public void operationComplete(ChannelFuture future)
>>> throws Exception {
>>>
>>> NettyKarmaReceiver.this.factory.releaseExternalResources();
>>>
>>> logger.log(InternalLogLevel.INFO,
>>> this.getClass().getSimpleName()
>>> + " end stop");
>>> }
>>>
>>> });
>>> }
>>>
>>>
>>>
>>> On Sep 9, 2009, at 10:09 AM, Thomas Bocek wrote:
>>>
>>>> Michael McGrady wrote:
>>>>> I am not getting a return from the NeoServerSocketChannelFactory's
>>>>> releaseExternalResources method. Is this something anyone else has
>>>>> seen? This is very surprising to me because this is just in essence a
>>>>> return from the ExecutorUtil terminate method which just copies and
>>>>> shuts down the copies as ExecutorServices shutdown method. There
>>>>> should be only a 100 millisecond wait in that method.
>>>>
>>>> The awaitTermination() call may return false, so it will wait longer
>>>> than 100msec.
>>>>
>>>>> Any ideas?
>>>>
>>>> Make sure you have closed all connections before calling
>>>> releaseExternalResources. You can use the ChannelGroup to group
>>>> channels
>>>> and close them with ChannelGroup.close().
>>>>
>>>> Thomas
>>>> _______________________________________________
>>>> netty-users mailing list
>>>> netty-users at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>>> Mike McGrady
>>> Principal Investigator AF081-028 AFRL SBIR
>>> Senior Engineer
>>> Topia Technology, Inc
>>> 1.253.720.3365
>>> mmcgrady at topiatechnology.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> netty-users mailing list
>>> netty-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/netty-users
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>
> Mike McGrady
> Principal Investigator AF081-028 AFRL SBIR
> Senior Engineer
> Topia Technology, Inc
> 1.253.720.3365
> mmcgrady at topiatechnology.com
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TCPCloseTest.java
Type: text/x-java
Size: 2707 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20090909/606c95ea/attachment-0001.bin
More information about the netty-users
mailing list