Best approach to wait for closing the channel

"이희승 (Trustin Lee)" trustin at gmail.com
Mon Aug 16 01:44:04 EDT 2010


If you have a reference to a Channel, you can do this:

Channel ch = ...;

    ChannelFuture future = ch.getCloseFuture();
    try {
        future.await();
    } catch (InterruptedException e) {
        ...
    }

HTH,
Trustin

On 07/15/2010 07:06 PM, Christian (VuuRWerK) Seifert wrote:
> Hi,
> 
> I search for a good and serious way to wait for closing the channel.
> So I want to do something like to join the Listener-Thread to suspend
> my main-thread. At the moment I do the following:
> ========= >8 =========
> try {
>   while (_isRunning) {
>     Thread.sleep(5); // :(
>   }
> } catch (InterruptedException ex) {
>   logger.error(ex, ex);
> }
> ========= >8 =========
> 
> It works, of course, but I guess I come to the "bad-programmers"-hell
> for that :(
> Has someone any suggestions to prevent me from this place?
> 
> Thanks in advance!
> 
> - Christian
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 293 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100816/78465cd9/attachment.bin 


More information about the netty-users mailing list