/** * Returns the time to wait (if any) for the given length message, using the given limitTraffic and * the max wait time. * * @param size * the write size * @param limitTraffic * the traffic limit in bytes per second. * @param maxTime * the max time in ms to wait in case of excess of traffic. * @return the current time to wait (in ms) if needed for Write operation. */ @Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
/** * Returns the time to wait (if any) for the given length message, using the given limitTraffic and * the max wait time. * * @param size * the write size * @param limitTraffic * the traffic limit in bytes per second. * @param maxTime * the max time in ms to wait in case of excess of traffic. * @return the current time to wait (in ms) if needed for Write operation. */ @Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
if (size > 0) { long waitGlobal = trafficCounter.writeTimeToWait(size, getWriteLimit(), maxTime, now); Integer key = ctx.channel().hashCode(); PerChannel perChannel = channelQueues.get(key); long wait = 0; if (perChannel != null) { wait = perChannel.channelTrafficCounter.writeTimeToWait(size, writeChannelLimit, maxTime, now); if (writeDeviationActive) {
if (size > 0) { long waitGlobal = trafficCounter.writeTimeToWait(size, getWriteLimit(), maxTime, now); Integer key = ctx.channel().hashCode(); PerChannel perChannel = channelQueues.get(key); long wait = 0; if (perChannel != null) { wait = perChannel.channelTrafficCounter.writeTimeToWait(size, writeChannelLimit, maxTime, now); if (writeDeviationActive) {
@Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { long size = calculateSize(msg); long now = TrafficCounter.milliSecondFromNano(); if (size > 0) { // compute the number of ms to wait before continue with the channel long wait = trafficCounter.writeTimeToWait(size, writeLimit, maxTime, now); if (wait >= MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Write suspend: " + wait + ':' + ctx.channel().config().isAutoRead() + ':' + isHandlerActive(ctx)); } submitWrite(ctx, msg, size, wait, now, promise); return; } } // to maintain order of write submitWrite(ctx, msg, size, 0, now, promise); }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { long size = calculateSize(msg); long now = TrafficCounter.milliSecondFromNano(); if (size > 0) { // compute the number of ms to wait before continue with the channel long wait = trafficCounter.writeTimeToWait(size, writeLimit, maxTime, now); if (wait >= MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Write suspend: " + wait + ':' + ctx.channel().config().isAutoRead() + ':' + isHandlerActive(ctx)); } submitWrite(ctx, msg, size, wait, now, promise); return; } } // to maintain order of write submitWrite(ctx, msg, size, 0, now, promise); }
/** * Returns the time to wait (if any) for the given length message, using the given limitTraffic and * the max wait time. * * @param size * the write size * @param limitTraffic * the traffic limit in bytes per second. * @param maxTime * the max time in ms to wait in case of excess of traffic. * @return the current time to wait (in ms) if needed for Write operation. */ @Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
if (size > 0) { long waitGlobal = trafficCounter.writeTimeToWait(size, getWriteLimit(), maxTime, now); Integer key = ctx.channel().hashCode(); PerChannel perChannel = channelQueues.get(key); long wait = 0; if (perChannel != null) { wait = perChannel.channelTrafficCounter.writeTimeToWait(size, writeChannelLimit, maxTime, now); if (writeDeviationActive) {
@Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { long size = calculateSize(msg); long now = TrafficCounter.milliSecondFromNano(); if (size > 0) { // compute the number of ms to wait before continue with the channel long wait = trafficCounter.writeTimeToWait(size, writeLimit, maxTime, now); if (wait >= MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Write suspend: " + wait + ':' + ctx.channel().config().isAutoRead() + ':' + isHandlerActive(ctx)); } submitWrite(ctx, msg, size, wait, now, promise); return; } } // to maintain order of write submitWrite(ctx, msg, size, 0, now, promise); }
/** * Returns the time to wait (if any) for the given length message, using the given limitTraffic and * the max wait time. * * @param size * the write size * @param limitTraffic * the traffic limit in bytes per second. * @param maxTime * the max time in ms to wait in case of excess of traffic. * @return the current time to wait (in ms) if needed for Write operation. */ @Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
/** * Returns the time to wait (if any) for the given length message, using the given limitTraffic and * the max wait time. * * @param size * the write size * @param limitTraffic * the traffic limit in bytes per second. * @param maxTime * the max time in ms to wait in case of excess of traffic. * @return the current time to wait (in ms) if needed for Write operation. */ @Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
/** * Returns the time to wait (if any) for the given length message, using the given limitTraffic and * the max wait time. * * @param size * the write size * @param limitTraffic * the traffic limit in bytes per second. * @param maxTime * the max time in ms to wait in case of excess of traffic. * @return the current time to wait (in ms) if needed for Write operation. */ @Deprecated public long writeTimeToWait(final long size, final long limitTraffic, final long maxTime) { return writeTimeToWait(size, limitTraffic, maxTime, milliSecondFromNano()); }
if (size > 0) { long waitGlobal = trafficCounter.writeTimeToWait(size, getWriteLimit(), maxTime, now); Integer key = ctx.channel().hashCode(); PerChannel perChannel = channelQueues.get(key); long wait = 0; if (perChannel != null) { wait = perChannel.channelTrafficCounter.writeTimeToWait(size, writeChannelLimit, maxTime, now); if (writeDeviationActive) {
if (size > 0) { long waitGlobal = trafficCounter.writeTimeToWait(size, getWriteLimit(), maxTime, now); Integer key = ctx.channel().hashCode(); PerChannel perChannel = channelQueues.get(key); long wait = 0; if (perChannel != null) { wait = perChannel.channelTrafficCounter.writeTimeToWait(size, writeChannelLimit, maxTime, now); if (writeDeviationActive) {
if (size > 0) { long waitGlobal = trafficCounter.writeTimeToWait(size, getWriteLimit(), maxTime, now); Integer key = ctx.channel().hashCode(); PerChannel perChannel = channelQueues.get(key); long wait = 0; if (perChannel != null) { wait = perChannel.channelTrafficCounter.writeTimeToWait(size, writeChannelLimit, maxTime, now); if (writeDeviationActive) {
@Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { long size = calculateSize(msg); long now = TrafficCounter.milliSecondFromNano(); if (size > 0) { // compute the number of ms to wait before continue with the channel long wait = trafficCounter.writeTimeToWait(size, writeLimit, maxTime, now); if (wait >= MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Write suspend: " + wait + ':' + ctx.channel().config().isAutoRead() + ':' + isHandlerActive(ctx)); } submitWrite(ctx, msg, size, wait, now, promise); return; } } // to maintain order of write submitWrite(ctx, msg, size, 0, now, promise); }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { long size = calculateSize(msg); long now = TrafficCounter.milliSecondFromNano(); if (size > 0) { // compute the number of ms to wait before continue with the channel long wait = trafficCounter.writeTimeToWait(size, writeLimit, maxTime, now); if (wait >= MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Write suspend: " + wait + ':' + ctx.channel().config().isAutoRead() + ':' + isHandlerActive(ctx)); } submitWrite(ctx, msg, size, wait, now, promise); return; } } // to maintain order of write submitWrite(ctx, msg, size, 0, now, promise); }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { long size = calculateSize(msg); long now = TrafficCounter.milliSecondFromNano(); if (size > 0) { // compute the number of ms to wait before continue with the channel long wait = trafficCounter.writeTimeToWait(size, writeLimit, maxTime, now); if (wait >= MINIMAL_WAIT) { if (logger.isDebugEnabled()) { logger.debug("Write suspend: " + wait + ':' + ctx.channel().config().isAutoRead() + ':' + isHandlerActive(ctx)); } submitWrite(ctx, msg, size, wait, now, promise); return; } } // to maintain order of write submitWrite(ctx, msg, size, 0, now, promise); }