[#2618] Introduce ChannelFuture.unvoid() and ChannelFuture.isVoid()

Motivation:

There is no way for a ChannelHandler to check if the passed in ChannelPromise for a write(...) call is a VoidChannelPromise. This is a problem as some handlers need to add listeners to the ChannelPromise which is not possible in the case of a VoidChannelPromise.

Modification:

- Introduce ChannelFuture.isVoid() which will return true if it is not possible to add listeners or wait on the result.
- Add ChannelFuture.unvoid() which allows to create a ChannelFuture out of a void ChannelFuture which supports all the operations.

Result:

It's now easy to write ChannelHandler implementations which also works when a void ChannelPromise is used.
Sure why not :)

> Am 02.07.2014 um 12:44 schrieb Trustin Lee <notifications@github.com>:
> 
> In handler/src/main/java/io/netty/handler/timeout/IdleStateHandler.java:
> 
> > @@ -256,14 +256,15 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
> >  
> >      @Override
> >      public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
> > -        promise.addListener(new ChannelFutureListener() {
> > +        ChannelPromise unvoid = promise.unvoid();
> > +        unvoid.addListener(new ChannelFutureListener() {
> promise = promise.unvoid(); might be cleaner in this case?
> 
> —
> Reply to this email directly or view it on GitHub.