Fixed issue NETTY-50 (Dead lock in MemoryAwareThreadPoolExecutor)

* Made sure that the max memory size properties become immutable
This commit is contained in:
Trustin Lee 2008-09-30 00:31:32 +00:00
parent 50f043fa3e
commit 6f18c940dd

View File

@ -197,6 +197,12 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
throw new IllegalArgumentException(
"maxChannelMemorySize: " + maxChannelMemorySize);
}
if (getTaskCount() > 0) {
throw new IllegalStateException(
"can't be changed after a task is executed");
}
settings = new Settings(maxChannelMemorySize, settings.maxTotalMemorySize);
}
@ -216,6 +222,12 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
throw new IllegalArgumentException(
"maxTotalMemorySize: " + maxTotalMemorySize);
}
if (getTaskCount() > 0) {
throw new IllegalStateException(
"can't be changed after a task is executed");
}
settings = new Settings(settings.maxChannelMemorySize, maxTotalMemorySize);
}