private static void initialize(Configuration conf, Channel channel, DatanodeInfo dnInfo, Enum<?> storageType, OpWriteBlockProto.Builder writeBlockProtoBuilder, int timeoutMs, DFSClient client, Token<BlockTokenIdentifier> accessToken, Promise<Channel> promise) throws IOException { Promise<Void> saslPromise = channel.eventLoop().newPromise(); trySaslNegotiate(conf, channel, dnInfo, timeoutMs, client, accessToken, saslPromise); saslPromise.addListener(new FutureListener<Void>() { @Override public void operationComplete(Future<Void> future) throws Exception { if (future.isSuccess()) { // setup response processing pipeline first, then send request. processWriteBlockResponse(channel, dnInfo, promise, timeoutMs); requestWriteBlock(channel, storageType, writeBlockProtoBuilder); } else { promise.tryFailure(future.cause()); } } }); }
return; Promise<Boolean> saslPromise = ch.eventLoop().newPromise(); final NettyHBaseSaslRpcClientHandler saslHandler; try {
Promise<Boolean> connectionHeaderPromise = ch.eventLoop().newPromise();
return; Promise<Boolean> saslPromise = ch.eventLoop().newPromise(); final NettyHBaseSaslRpcClientHandler saslHandler; try {
@Override public EventExecutor executor() { if (executor == null) { return channel().eventLoop(); } else { return executor; } }
@Override public EventLoop eventLoop() { return parent().eventLoop(); }
Promise<Boolean> connectionHeaderPromise = ch.eventLoop().newPromise();
@Override public final void handlerAdded0(ChannelHandlerContext ctx) throws Exception { if (ctx.executor() != ctx.channel().eventLoop()) { throw new IllegalStateException("EventExecutor must be EventLoop of Channel"); } this.ctx = ctx; }
private void scheduleFlush(final ChannelHandlerContext ctx) { if (nextScheduledFlush == null) { // Run as soon as possible, but still yield to give a chance for additional writes to enqueue. nextScheduledFlush = ctx.channel().eventLoop().submit(flushTask); } }
@Override protected void initChannel(Channel ch) throws Exception { assert ch.eventLoop().inEventLoop(); handler.channelCreated(ch); } });
@Override protected EventExecutor executor() { EventExecutor e = super.executor(); if (e == null) { return channel().eventLoop(); } else { return e; } }
@Override protected EventExecutor executor() { EventExecutor e = super.executor(); if (e == null) { return channel().eventLoop(); } else { return e; } }
@Override protected EventExecutor executor() { EventExecutor e = super.executor(); if (e == null) { return channel().eventLoop(); } else { return e; } }
public Future<Http2StreamChannel> open() { return open(channel.eventLoop().<Http2StreamChannel>newPromise()); }
@Override public final Future<Void> release(Channel channel) { return release(channel, channel.eventLoop().<Void>newPromise()); }
final void invokeHandlerAddedIfNeeded() { assert channel.eventLoop().inEventLoop(); if (firstRegistration) { firstRegistration = false; // We are now registered to the EventLoop. It's time to call the callbacks for the ChannelHandlers, // that were added before the registration was done. callHandlerAddedForAllHandlers(); } }
@Override public Future<Boolean> isHealthy(Channel channel) { EventLoop loop = channel.eventLoop(); return channel.isActive()? loop.newSucceededFuture(Boolean.TRUE) : loop.newSucceededFuture(Boolean.FALSE); } };
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { final ChannelConfig config = ctx.channel().config(); if (config.isAutoRead()) { // stop accept new connections for 1 second to allow the channel to recover // See https://github.com/netty/netty/issues/1328 config.setAutoRead(false); ctx.channel().eventLoop().schedule(enableAutoReadTask, 1, TimeUnit.SECONDS); } // still let the exceptionCaught event flow through the pipeline to give the user // a chance to do something with it ctx.fireExceptionCaught(cause); } }