@Deprecated @Override public ChannelFuture register(Channel channel, ChannelPromise promise) { channel.unsafe().register(this, promise); return promise; }
@Deprecated @Override public ChannelFuture register(final Channel channel, final ChannelPromise promise) { if (channel == null) { throw new NullPointerException("channel"); } if (promise == null) { throw new NullPointerException("promise"); } channel.unsafe().register(this, promise); return promise; }
@Deprecated @Override public ChannelFuture register(Channel channel, ChannelPromise promise) { channel.unsafe().register(this, promise); return promise; }
@Deprecated @Override public ChannelFuture register(final Channel channel, final ChannelPromise promise) { if (channel == null) { throw new NullPointerException("channel"); } if (promise == null) { throw new NullPointerException("promise"); } channel.unsafe().register(this, promise); return promise; }
HeadContext(DefaultChannelPipeline pipeline) { super(pipeline, null, HEAD_NAME, true, true); unsafe = pipeline.channel().unsafe(); setAddComplete(); }
private static void forceClose(Channel child, Throwable t) { child.unsafe().closeForcibly(); logger.warn("Failed to register an accepted channel: {}", child, t); }
void setUserDefinedWritability(ChannelHandlerContext ctx, boolean writable) { ChannelOutboundBuffer cob = ctx.channel().unsafe().outboundBuffer(); if (cob != null) { cob.setUserDefinedWritability(userDefinedWritabilityIndex, writable); } }
HeadContext(DefaultChannelPipeline pipeline) { super(pipeline, null, HEAD_NAME, true, true); unsafe = pipeline.channel().unsafe(); setAddComplete(); }
private static void forceClose(Channel child, Throwable t) { child.unsafe().closeForcibly(); logger.warn("Failed to register an accepted channel: {}", child, t); }
/** * @see #hasOutputChanged(ChannelHandlerContext, boolean) */ private void initOutputChanged(ChannelHandlerContext ctx) { if (observeOutput) { Channel channel = ctx.channel(); Unsafe unsafe = channel.unsafe(); ChannelOutboundBuffer buf = unsafe.outboundBuffer(); if (buf != null) { lastMessageHashCode = System.identityHashCode(buf.current()); lastPendingWriteBytes = buf.totalPendingWriteBytes(); } } }
@Override public ChannelFuture register(ChannelPromise promise) { ObjectUtil.checkNotNull(promise, "promise"); promise.channel().unsafe().register(this, promise); return promise; }
@UnstableApi protected void incrementPendingOutboundBytes(long size) { ChannelOutboundBuffer buffer = channel.unsafe().outboundBuffer(); if (buffer != null) { buffer.incrementPendingOutboundBytes(size); } }
@UnstableApi protected void decrementPendingOutboundBytes(long size) { ChannelOutboundBuffer buffer = channel.unsafe().outboundBuffer(); if (buffer != null) { buffer.decrementPendingOutboundBytes(size); } }
@Override public ChannelFuture register(final ChannelPromise promise) { ObjectUtil.checkNotNull(promise, "promise"); promise.channel().unsafe().register(this, promise); return promise; }
@UnstableApi protected void incrementPendingOutboundBytes(long size) { ChannelOutboundBuffer buffer = channel.unsafe().outboundBuffer(); if (buffer != null) { buffer.incrementPendingOutboundBytes(size); } }
@UnstableApi protected void decrementPendingOutboundBytes(long size) { ChannelOutboundBuffer buffer = channel.unsafe().outboundBuffer(); if (buffer != null) { buffer.decrementPendingOutboundBytes(size); } }
@Override public ChannelFuture register(final ChannelPromise promise) { ObjectUtil.checkNotNull(promise, "promise"); promise.channel().unsafe().register(this, promise); return promise; }
@Override public ChannelFuture register(ChannelPromise promise) { ObjectUtil.checkNotNull(promise, "promise"); promise.channel().unsafe().register(this, promise); return promise; }
static PendingBytesTracker newTracker(Channel channel) { if (channel.pipeline() instanceof DefaultChannelPipeline) { return new DefaultChannelPipelinePendingBytesTracker((DefaultChannelPipeline) channel.pipeline()); } else { ChannelOutboundBuffer buffer = channel.unsafe().outboundBuffer(); MessageSizeEstimator.Handle handle = channel.config().getMessageSizeEstimator().newHandle(); // We need to guard against null as channel.unsafe().outboundBuffer() may returned null // if the channel was already closed when constructing the PendingBytesTracker. // See https://github.com/netty/netty/issues/3967 return buffer == null ? new NoopPendingBytesTracker(handle) : new ChannelOutboundBufferPendingBytesTracker(buffer, handle); } }
static PendingBytesTracker newTracker(Channel channel) { if (channel.pipeline() instanceof DefaultChannelPipeline) { return new DefaultChannelPipelinePendingBytesTracker((DefaultChannelPipeline) channel.pipeline()); } else { ChannelOutboundBuffer buffer = channel.unsafe().outboundBuffer(); MessageSizeEstimator.Handle handle = channel.config().getMessageSizeEstimator().newHandle(); // We need to guard against null as channel.unsafe().outboundBuffer() may returned null // if the channel was already closed when constructing the PendingBytesTracker. // See https://github.com/netty/netty/issues/3967 return buffer == null ? new NoopPendingBytesTracker(handle) : new ChannelOutboundBufferPendingBytesTracker(buffer, handle); } }