Shutdown of Server Channel Factory

Michael McGrady mmcgrady at topiatechnology.com
Wed Sep 9 14:25:51 EDT 2009


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







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090909/65d9de79/attachment.html 


More information about the netty-users mailing list