public synchronized boolean resumeChannel(String remoteAddress) { Channel ch = channelMap.get(remoteAddress); if (ch != null) { LOG.debug("Resume channel={}", remoteAddress); ch.setReadable(true); return true; } else { LOG.debug("Channel to be resumed is null"); return false; } }
public synchronized boolean suspendChannel(String remoteAddress) { Channel ch = channelMap.get(remoteAddress); if (ch != null) { LOG.debug("Suspend channel={}", remoteAddress); ch.setReadable(false); return true; } else { LOG.debug("Channel to be suspended is null!"); return false; } }
private ChannelFuture disableRecvNoWait() { throttled = true; if (LOG.isDebugEnabled()) { LOG.debug("Throttling - disabling recv " + this); } return channel.setReadable(false); }
private void possiblySuspendReads(ClientResponse<?> response) { if (!response.isContinueReading()) { synchronized (watermarkLock) { suspendWatermark = Math.max(suspendWatermark, currentChunkNum); if (suspendWatermark > resumeWatermark) { channel.setReadable(false); backPressureStartTimeNs = System.nanoTime(); log.debug("[%s] Suspended reads from channel (chunkNum = %,d).", requestDesc, currentChunkNum); } } } }
public ChannelGroupFuture setReadable(boolean readable) { Map<Integer, ChannelFuture> futures = new LinkedHashMap<Integer, ChannelFuture>(size()); for (Channel c: serverChannels.values()) { futures.put(c.getId(), c.setReadable(readable).awaitUninterruptibly()); } for (Channel c: nonServerChannels.values()) { futures.put(c.getId(), c.setReadable(readable)); } return new DefaultChannelGroupFuture(this, futures); }
/** * Release the Read suspension. */ void releaseReadSuspended(ChannelHandlerContext ctx) { ReadWriteStatus rws = checkAttachment(ctx); rws.readSuspend = false; ctx.getChannel().setReadable(true); }
private void finishRequest() { ClientResponse<Final> finalResponse = handler.done(response); if (!finalResponse.isFinished() || !finalResponse.isContinueReading()) { throw new ISE( "[%s] Didn't get a completed ClientResponse Object from [%s] (finished = %s, continueReading = %s)", requestDesc, handler.getClass(), finalResponse.isFinished(), finalResponse.isContinueReading() ); } if (!retVal.isDone()) { retVal.set(finalResponse.getObj()); } removeHandlers(); channel.setReadable(true); channelResourceContainer.returnResource(); }
LOG.debug("queue empty"); cnxn.channel.setReadable(true); } else { ChannelBuffer buf = (ChannelBuffer)e.getMessage();
@Override public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { this.ctx = ctx; // readSuspended = true; ReadWriteStatus rws = checkAttachment(ctx); rws.readSuspend = true; ctx.getChannel().setReadable(false); if (trafficCounter == null) { // create a new counter now if (timer != null) { trafficCounter = new TrafficCounter(this, timer, "ChannelTC" + ctx.getChannel().getId(), checkInterval); } } if (trafficCounter != null) { trafficCounter.start(); } rws.readSuspend = false; ctx.getChannel().setReadable(true); super.channelConnected(ctx, e); }
channel.setReadable(true); channel.setReadable(true);
channel.setReadable(true); long backPressureDuration = System.nanoTime() - backPressureStartTimeNs; log.debug("[%s] Resumed reads from channel (chunkNum = %,d).", requestDesc, resumeChunkNum);
channel.setReadable(false);
channel.setReadable(true);
channel.setReadable(false); if (logger.isDebugEnabled()) { logger.debug("Suspend final status => " + channel.isReadable() + ':' +
channel.setReadable(false); if (logger.isDebugEnabled()) { logger.debug("Suspend final status => " + channel.isReadable() + ':' +
channel.setReadable(true);
/** * Resume the connection, see {@link ReadStream#resume} */ public void resume() { channel.setReadable(true); }
public synchronized boolean suspendChannel(String remoteAddress) { Channel ch = channelMap.get(remoteAddress); if (ch != null) { LOG.debug("Suspend channel={}", remoteAddress); ch.setReadable(false); return true; } else { LOG.debug("Channel to be suspended is null!"); return false; } }
@Override public void pushLineHandler(ImapLineHandler lineHandler) { channel.setReadable(false); channel.getPipeline().addBefore(REQUEST_DECODER, "lineHandler" + handlerCount++, new ImapLineHandlerAdapter(this, lineHandler)); channel.setReadable(true); }
public static void blockChannelReads(ChannelHandlerContext ctx) { // Remember that reads are blocked (there is no Channel.getReadable()) getDispatcherContext(ctx).readBlockedState = ReadBlockedState.BLOCKED; // NOTE: this shuts down reads, but isn't a 100% guarantee we won't get any more messages. // It sets up the channel so that the polling loop will not report any new read events // and netty won't read any more data from the socket, but any messages already fully read // from the socket before this ran may still be decoded and arrive at this handler. Thus // the limit on queued messages before we block reads is more of a guidance than a hard // limit. ctx.getChannel().setReadable(false); }