@Override public ChannelPromise newPromise() { return ctx.newPromise(); }
@Override public ChannelPromise newPromise() { return ctx.newPromise(); }
@Override public ChannelPromise newPromise() { return ctx.newPromise(); }
/** * Sends an SSL {@code close_notify} message to the specified channel and * destroys the underlying {@link SSLEngine}. This will <strong>not</strong> close the underlying * {@link Channel}. If you want to also close the {@link Channel} use {@link Channel#close()} or * {@link ChannelHandlerContext#close()} */ public ChannelFuture closeOutbound() { return closeOutbound(ctx.newPromise()); }
@Override public void run() { // May be done in the meantime as cancel(...) is only best effort. if (!flushFuture.isDone()) { logger.warn("{} Last write attempt timed out; force-closing the connection.", ctx.channel()); addCloseListener(ctx.close(ctx.newPromise()), promise); } } }, closeNotifyTimeout, TimeUnit.MILLISECONDS);
/** * Close this {@link Bzip2Encoder} and so finish the encoding. * * The returned {@link ChannelFuture} will be notified once the operation completes. */ public ChannelFuture close() { return close(ctx().newPromise()); }
/** * Close this {@link Lz4FrameEncoder} and so finish the encoding. * * The returned {@link ChannelFuture} will be notified once the operation completes. */ public ChannelFuture close() { return close(ctx().newPromise()); }
@Override public ChannelFuture close() { return close(ctx().newPromise()); }
private void _writeGoAway(long errorCode, int lastStreamId, ByteBuf debugData) { encoder().writeGoAway(chctx, lastStreamId, errorCode, debugData, chctx.newPromise()); chctx.flush(); }
private void _writeReset(int streamId, long code) { encoder().writeRstStream(chctx, streamId, code, chctx.newPromise()); chctx.flush(); }
/** * Close this {@link Bzip2Encoder} and so finish the encoding. * * The returned {@link ChannelFuture} will be notified once the operation completes. */ public ChannelFuture close() { return close(ctx().newPromise()); }
/** * Close this {@link Lz4FrameEncoder} and so finish the encoding. * * The returned {@link ChannelFuture} will be notified once the operation completes. */ public ChannelFuture close() { return close(ctx().newPromise()); }
@Override public ChannelFuture close() { return close(ctx().newPromise()); }
private void _writeFrame(Http2Stream stream, byte type, short flags, ByteBuf payload) { encoder().writeFrame(chctx, type, stream.id(), new Http2Flags(flags), payload, chctx.newPromise()); chctx.flush(); }
@Override public void close(final ChannelHandlerContext ctx, final ChannelPromise promise) throws Exception { ChannelFuture f = finishEncode(ctx, ctx.newPromise()); f.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture f) throws Exception { ctx.close(promise); } }); if (!f.isDone()) { // Ensure the channel is closed even if the write operation completes in time. ctx.executor().schedule(new Runnable() { @Override public void run() { ctx.close(promise); } }, 10, TimeUnit.SECONDS); // FIXME: Magic number } }
private void _writePriority(Http2Stream stream, int streamDependency, short weight, boolean exclusive) { encoder().writePriority(chctx, stream.id(), streamDependency, weight, exclusive, chctx.newPromise()); }
ChannelFuture writePing(long data) { ChannelPromise promise = chctx.newPromise(); EventExecutor executor = chctx.executor(); if (executor.inEventLoop()) { _writePing(data, promise); } else { executor.execute(() -> { _writePing(data, promise); }); } return promise; }
ChannelFuture writeSettings(Http2Settings settingsUpdate) { ChannelPromise promise = chctx.newPromise(); EventExecutor executor = chctx.executor(); if (executor.inEventLoop()) { _writeSettings(settingsUpdate, promise); } else { executor.execute(() -> { _writeSettings(settingsUpdate, promise); }); } return promise; }
@Override public ChannelFuture close(final ChannelPromise promise) { ChannelHandlerContext ctx = ctx(); EventExecutor executor = ctx.executor(); if (executor.inEventLoop()) { return finishEncode(ctx, promise); } else { final ChannelPromise p = ctx.newPromise(); executor.execute(new Runnable() { @Override public void run() { ChannelFuture f = finishEncode(ctx(), p); f.addListener(new ChannelPromiseNotifier(promise)); } }); return p; } }
@Override public ChannelFuture close(final ChannelPromise promise) { ChannelHandlerContext ctx = ctx(); EventExecutor executor = ctx.executor(); if (executor.inEventLoop()) { return finishEncode(ctx, promise); } else { final ChannelPromise p = ctx.newPromise(); executor.execute(new Runnable() { @Override public void run() { ChannelFuture f = finishEncode(ctx(), p); f.addListener(new ChannelPromiseNotifier(promise)); } }); return p; } }