From 7de92967c2a3f924b4bff16b0d51d9b9aa1ad58c Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 30 Sep 2008 01:52:02 +0000 Subject: [PATCH] Made MemoryAwareThreadPoolExecutor.shouldCount() extensible --- .../handler/execution/MemoryAwareThreadPoolExecutor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java index 8df80a57ac..06d9f409d9 100644 --- a/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java +++ b/src/main/java/org/jboss/netty/handler/execution/MemoryAwareThreadPoolExecutor.java @@ -367,7 +367,13 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor { return counter; } - private static boolean shouldCount(Runnable task) { + /** + * Returns {@code true} if and only if the specified {@code task} should + * be counted to limit the global and per-channel memory consumption. + * To override this method, you must call {@code super.shouldCount()} to + * make sure important tasks are not counted. + */ + protected boolean shouldCount(Runnable task) { if (task instanceof Executor) { return false; }