Example usage for io.netty.channel ChannelPromiseNotifier ChannelPromiseNotifier

List of usage examples for io.netty.channel ChannelPromiseNotifier ChannelPromiseNotifier

Introduction

In this page you can find the example usage for io.netty.channel ChannelPromiseNotifier ChannelPromiseNotifier.

Prototype

public ChannelPromiseNotifier(ChannelPromise... promises) 

Source Link

Document

Create a new instance

Usage

From source file:org.dcache.xrootd.door.ConcurrentXrootdRequestHandler.java

License:Open Source License

@Override
protected ChannelFuture respond(ChannelHandlerContext ctx, Object response) {
    CDC cdc = new CDC();
    ChannelPromise promise = ctx.newPromise();
    ctx.executor().execute(() -> {/*from  www  . ja  v  a  2  s.  c  om*/
        try (CDC ignored = cdc.restore()) {
            ctx.writeAndFlush(response).addListener(future -> {
                if (!future.isSuccess()) {
                    exceptionCaught(ctx, future.cause());
                }
            }).addListener(new ChannelPromiseNotifier(promise));
        }
    });
    return promise;
}