本文整理了Java中io.netty.channel.Channel.bytesBeforeWritable()
方法的一些代码示例,展示了Channel.bytesBeforeWritable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.bytesBeforeWritable()
方法的具体详情如下:
包路径:io.netty.channel.Channel
类名称:Channel
方法名:bytesBeforeWritable
[英]Get how many bytes must be drained from underlying buffers until #isWritable() returns true. This quantity will always be non-negative. If #isWritable() is true then 0.
[中]获取在#isWritable()返回true之前必须从基础缓冲区中释放多少字节。该数量始终为非负。如果#isWritable()为真,则为0。
代码示例来源:origin: YeautyYE/netty-websocket-spring-boot-starter
/**
* Get how many bytes must be drained from underlying buffers until {@link #isWritable()} returns {@code true}.
* This quantity will always be non-negative. If {@link #isWritable()} is {@code true} then 0.
*/
public long bytesBeforeWritable() {
return channel.bytesBeforeWritable();
}
代码示例来源:origin: com.aliyun.angelia/angelia-remoting
@Override
public long bytesBeforeWritable() {
return channel.bytesBeforeWritable();
}
代码示例来源:origin: com.aliyun.angelia/angelia-remoting
@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
LOG.warn("Channel {} channelWritabilityChanged event triggered - bytesBeforeUnwritable:{},bytesBeforeWritable:{}", ctx.channel(),
ctx.channel().bytesBeforeUnwritable(), ctx.channel().bytesBeforeWritable());
}
代码示例来源:origin: com.aliyun.angelia/angelia-remoting
@Override
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
LOG.warn("Channel {} channelWritabilityChanged event triggered - bytesBeforeUnwritable:{},bytesBeforeWritable:{}", ctx.channel(),
ctx.channel().bytesBeforeUnwritable(), ctx.channel().bytesBeforeWritable());
}
代码示例来源:origin: com.aliyun.angelia/angelia-remoting
@Override
public void invokeAsync(final RemotingContext context, final AsyncHandler handler) {
String addr = context.getAddress();
final Channel channel = this.createIfAbsent(addr);
if (channel != null && channel.isActive()) {
// We support Netty's channel-level backpressure thereby respecting slow receivers on the other side.
if (!channel.isWritable()) {
// Note: It's up to the layer above a transport to decide whether or not to requeue a canceled write.
LOG.warn("Channel statistics - bytesBeforeUnwritable:{},bytesBeforeWritable:{}", channel.bytesBeforeUnwritable(), channel.bytesBeforeWritable());
}
context.setChannel(new NettyChannelImpl(channel));
this.invokeAsyncWithInterceptor(context, handler);
} else {
this.closeChannel(addr, channel);
}
}
代码示例来源:origin: com.aliyun.angelia/angelia-remoting
@Override
public void invokeOneWay(final RemotingContext context) {
String addr = context.getAddress();
final Channel channel = this.createIfAbsent(addr);
if (channel != null && channel.isActive()) {
if (!channel.isWritable()) {
//if (this.clientConfig.isSocketFlowControl()) {
LOG.warn("Channel statistics - bytesBeforeUnwritable:{},bytesBeforeWritable:{}", channel.bytesBeforeUnwritable(), channel.bytesBeforeWritable());
//throw new ServiceInvocationFailureException(String.format("Channel[%s] is not writable now", channel.toString()));
}
context.setChannel(new NettyChannelImpl(channel));
this.invokeOnewayWithInterceptor(context);
} else {
this.closeChannel(addr, channel);
}
}
内容来源于网络,如有侵权,请联系作者删除!