|
52 | 52 | import java.net.InetSocketAddress; |
53 | 53 | import java.net.SocketAddress; |
54 | 54 | import java.time.Duration; |
55 | | -import java.util.Queue; |
56 | | -import java.util.concurrent.ConcurrentLinkedQueue; |
57 | 55 | import java.util.concurrent.CountDownLatch; |
58 | 56 | import java.util.concurrent.ExecutionException; |
59 | 57 | import java.util.concurrent.TimeUnit; |
@@ -355,7 +353,6 @@ public void writeFrame(Frame frame) throws IOException { |
355 | 353 | if (canWriteNow) { |
356 | 354 | this.doWriteFrame(frame); |
357 | 355 | } else { |
358 | | - this.handler.logEvents(); |
359 | 356 | throw new IOException("Frame enqueuing failed"); |
360 | 357 | } |
361 | 358 | } catch (InterruptedException e) { |
@@ -485,42 +482,9 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception |
485 | 482 | } |
486 | 483 | } |
487 | 484 |
|
488 | | - private static class Event { |
489 | | - private final long time; |
490 | | - private final String label; |
491 | | - |
492 | | - public Event(long time, String label) { |
493 | | - this.time = time; |
494 | | - this.label = label; |
495 | | - } |
496 | | - |
497 | | - @Override |
498 | | - public String toString() { |
499 | | - return this.label + " " + this.time; |
500 | | - } |
501 | | - } |
502 | | - |
503 | | - private static final int MAX_EVENTS = 100; |
504 | | - private final Queue<Event> events = new ConcurrentLinkedQueue<>(); |
505 | | - |
506 | | - private void logEvents() { |
507 | | - if (this.events.size() > 0) { |
508 | | - long start = this.events.peek().time; |
509 | | - LOGGER.info("channel writability history:"); |
510 | | - events.forEach(e -> LOGGER.info("{}: {}", (e.time - start) / 1_000_000, e.label)); |
511 | | - } |
512 | | - } |
513 | | - |
514 | 485 | @Override |
515 | 486 | public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { |
516 | 487 | boolean canWrite = ctx.channel().isWritable(); |
517 | | - Event event = new Event(System.nanoTime(), Boolean.toString(canWrite)); |
518 | | - if (this.events.size() >= MAX_EVENTS) { |
519 | | - this.events.poll(); |
520 | | - this.events.offer(event); |
521 | | - } |
522 | | - this.events.add(event); |
523 | | - |
524 | 488 | if (this.writable.compareAndSet(!canWrite, canWrite)) { |
525 | 489 | if (canWrite) { |
526 | 490 | CountDownLatch latch = writableLatch.getAndSet(new CountDownLatch(1)); |
|
0 commit comments