List of usage examples for io.netty.util.internal PromiseNotificationUtil tryFailure
public static void tryFailure(Promise<?> p, Throwable cause, InternalLogger logger)
From source file:org.apache.hyracks.http.server.HttpRequestCapacityController.java
License:Apache License
public static void reject(ChannelHandlerContext ctx) { HttpResponseEncoder encoder = new HttpResponseEncoder(); ChannelPromise promise = ctx.newPromise(); promise.addListener(ChannelFutureListener.CLOSE); DefaultFullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.SERVICE_UNAVAILABLE); try {/* w w w .j a va 2s . c o m*/ encoder.write(ctx, response, ctx.voidPromise()); ctx.writeAndFlush(ctx.alloc().buffer(0), promise); } catch (Throwable th) {//NOSONAR try { LOGGER.log(Level.SEVERE, "Failure during request rejection", th); } catch (Throwable loggingFailure) {//NOSONAR } PromiseNotificationUtil.tryFailure(promise, th, null); } }