From c40b0d2e07a44e35cc9ee2453c1f2ef8ff87cd23 Mon Sep 17 00:00:00 2001 From: Jakob Buchgraber Date: Mon, 1 Sep 2014 16:10:45 +0200 Subject: [PATCH] Reset interrupted flag in SingleThreadEventLoopTest. Fixes #2841 Motivation: Once the interrupted flag in SingleThreadEventLoopB was set it was never reset. That way the eventloop thread was always in an interrupted state and all calls to Thread.sleep/LockSupport.parkNanos would fail. Modifications: Reset interrupted flag. Result: Number of GC runs when executing the test is down to zero (from 20 - 50). Looking at the heap dump shows >10x decrease in memory consumption e.g. the number of ForkJoinTasks is down to 25k from 350k previously. Similar is true for BlockingQueue.Node objects. --- .../test/java/io/netty/channel/SingleThreadEventLoopTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java b/transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java index dc8621b8c3..3a69580817 100644 --- a/transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java +++ b/transport/src/test/java/io/netty/channel/SingleThreadEventLoopTest.java @@ -738,6 +738,7 @@ public class SingleThreadEventLoopTest { if (interrupted) { thread.interrupt(); + interrupted = false; } // We use LockSupport.parkNanos() and NOT Thread.sleep() to eliminate the overhead of creating a new