public boolean isNotWritable() { return !chctx.channel().isWritable(); }
public boolean isWritable() { return this.channelFuture.channel().isWritable(); }
@Override public void channelWritabilityChanged(final ChannelHandlerContext context) { if (context.channel().isWritable()) { synchronized (this) { this.notifyAll(); } } } }
@Override public void channelWritabilityChanged(final ChannelHandlerContext context) { if (context.channel().isWritable()) { synchronized (this) { this.notifyAll(); } } } }
@Override public void channelWritabilityChanged(final ChannelHandlerContext context) { if (context.channel().isWritable()) { synchronized (this) { this.notifyAll(); } } } }
public void write(byte[]... buf) throws IOException { if (channel != null && channel.isWritable()) { channel.writeAndFlush(Unpooled.copiedBuffer(buf)); } else { throw new IOException("write failed ! please checking !"); } }
@Override public int getInterestOps() { // This might not be 100% right, but it's only used for printing // connection info in the netty implementation so it's probably ok. if (channel == null || !channel.isOpen()) { return 0; } int interestOps = 0; if (!throttled.get()) { interestOps |= SelectionKey.OP_READ; } if (!channel.isWritable()) { // OP_READ means "can read", but OP_WRITE means "cannot write", // it's weird. interestOps |= SelectionKey.OP_WRITE; } return interestOps; }
@Override public void release( Channel channel ) { if ( channel.isWritable() ) { ThrottleLock lock = channel.attr( LOCK_KEY ).get(); lock.unlock( channel ); } }
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) { synchronized (lock) { if (ctx.channel().isWritable()) { lock.notifyAll(); } } ctx.fireChannelWritabilityChanged(); }
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { if (!ctx.channel().isWritable()) { // The writability of the channel changed to false, so flush all consolidated flushes now to free up memory. flushIfNeeded(ctx); } ctx.fireChannelWritabilityChanged(); }
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { if (ctx.channel().isWritable()) { // channel is writable again try to continue flushing doFlush(ctx); } ctx.fireChannelWritabilityChanged(); }
public static String channelInfoForLogging(Channel ch) { if (ch == null) { return "null"; } String channelInfo = ch.toString() + ", active=" + ch.isActive() + ", open=" + ch.isOpen() + ", registered=" + ch.isRegistered() + ", writable=" + ch.isWritable() + ", id=" + ch.id(); CurrentPassport passport = CurrentPassport.fromChannel(ch); return "Channel: " + channelInfo + ", Passport: " + String.valueOf(passport); } }
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { Channel realServerChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get(); if (realServerChannel != null) { realServerChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable()); } super.channelWritabilityChanged(ctx); }
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { Channel userChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get(); if (userChannel != null) { userChannel.config().setOption(ChannelOption.AUTO_READ, ctx.channel().isWritable()); } super.channelWritabilityChanged(ctx); }
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { if (!ctx.channel().isWritable()) { // The writability of the channel changed to false, so flush all consolidated flushes now to free up memory. flushIfNeeded(ctx); } ctx.fireChannelWritabilityChanged(); }
@Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { Channel realServerChannel = ctx.channel(); Channel proxyChannel = realServerChannel.attr(Constants.NEXT_CHANNEL).get(); if (proxyChannel != null) { proxyChannel.config().setOption(ChannelOption.AUTO_READ, realServerChannel.isWritable()); } super.channelWritabilityChanged(ctx); }
public boolean isWritable() { ClientCnx cnx = connectionHandler.getClientCnx(); return cnx != null && cnx.channel().isWritable(); }
@Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { closeInput((ChunkedInput<?>) pendingMessage); currentWrite.fail(future.cause()); } else { currentWrite.progress(chunks.progress(), chunks.length()); if (channel.isWritable()) { resumeTransfer(); } } } });
public static String channelInfoForLogging(Channel ch) { if (ch == null) { return "null"; } String channelInfo = ch.toString() + ", active=" + ch.isActive() + ", open=" + ch.isOpen() + ", registered=" + ch.isRegistered() + ", writable=" + ch.isWritable() + ", id=" + ch.id(); CurrentPassport passport = CurrentPassport.fromChannel(ch); return "Channel: " + channelInfo + ", Passport: " + String.valueOf(passport); } }
@Test public void shouldResumeWhenWritableOnceAgain() throws Exception { // given TransportThrottle throttle = newThrottleAndInstall( channel ); when( channel.isWritable() ).thenReturn( false ).thenReturn( true ); // when throttle.acquire( channel ); // expect verify( lock, atLeast( 1 ) ).lock( any(), anyLong() ); verify( lock, never() ).unlock( any() ); }