Blocking with channelGroup.close with awaitUninterruptibly

Trustin Lee tlee at redhat.com
Wed Dec 17 04:41:29 EST 2008


Hi Frederic,

Thanks for reporting a bug.  I was able to reproduce it from your
example and have just checked in the fix.  The returned
ChannelGroupFuture didn't complete at all when there's no channel in the
group (because the connection is closed already.)

Now that this bug is fixed, I think the example should be modified to
call awaitUninterruptibly().

Cheers,
Trustin

On Wed, Dec 17, 2008 at 02:33:26AM +0900, Frederic Bregier wrote:
> 
> Hi Trustin,
> 
> I've got a short question (I guess).
> If you take the example from the wiki, you can easily reproduce the
> behaviour.
> It is true for the client and for the server.
> Here is the logic:
> 
> In the main class:
> ChannelGroup channelGroup = ChabbelGroupFactory.getGroup(...);
> ClientBootstrap  bootstrap = new ClientBootstrap(...);
> ... (adding the handler and the channelGroup to the handler)
> ChannelFuture future = bootstrap.connect(...).awaitUninterruptibly();
> Channel channel = future.getChannel();
> channelGroup.add(channel);
> 
> In the Handler:
> void channelConnected(...) {
>   channelGroup.add(ctx.getChannel();
> }
> 
> Back into the client main class:
> channelGroup.close();
> 
> In this case, no problem.
> But if I do:
> channelGroup.close().awaitUninterruptibly();
> It blocks forever...
> 
> Do I missed something?
> 
> Frederic
> 
> -----
> Hardware/Software Architect
 
-- 
Trustin Lee, Principal Software Engineer, JBoss, a division of Red Hat
--
what we call human nature in actuality is human habit
--
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/netty-dev/attachments/20081217/95710187/attachment.bin 


More information about the netty-dev mailing list