Use ChannelEventRunnable where possible. #111
This commit is contained in:
parent
b089864650
commit
f977f476cf
@ -363,8 +363,8 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
|
||||
|
||||
int increment = settings.objectSizeEstimator.estimateSize(task);
|
||||
|
||||
if (task instanceof ChannelUpstreamEventRunnable) {
|
||||
ChannelUpstreamEventRunnable eventTask = (ChannelUpstreamEventRunnable) task;
|
||||
if (task instanceof ChannelEventRunnable) {
|
||||
ChannelEventRunnable eventTask = (ChannelEventRunnable) task;
|
||||
eventTask.estimatedSize = increment;
|
||||
Channel channel = eventTask.getEvent().getChannel();
|
||||
long channelCounter = getChannelCounter(channel).addAndGet(increment);
|
||||
@ -408,8 +408,8 @@ public class MemoryAwareThreadPoolExecutor extends ThreadPoolExecutor {
|
||||
totalLimiter.decrease(increment);
|
||||
}
|
||||
|
||||
if (task instanceof ChannelUpstreamEventRunnable) {
|
||||
ChannelUpstreamEventRunnable eventTask = (ChannelUpstreamEventRunnable) task;
|
||||
if (task instanceof ChannelEventRunnable) {
|
||||
ChannelEventRunnable eventTask = (ChannelEventRunnable) task;
|
||||
Channel channel = eventTask.getEvent().getChannel();
|
||||
long channelCounter = getChannelCounter(channel).addAndGet(-increment);
|
||||
//System.out.println("DC: " + channelCounter + ", " + increment);
|
||||
|
@ -234,10 +234,10 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
|
||||
*/
|
||||
@Override
|
||||
protected void doExecute(Runnable task) {
|
||||
if (!(task instanceof ChannelUpstreamEventRunnable)) {
|
||||
if (!(task instanceof ChannelEventRunnable)) {
|
||||
doUnorderedExecute(task);
|
||||
} else {
|
||||
ChannelUpstreamEventRunnable r = (ChannelUpstreamEventRunnable) task;
|
||||
ChannelEventRunnable r = (ChannelEventRunnable) task;
|
||||
getChildExecutor(r.getEvent()).execute(task);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user