Reduce memory footprint by resurrecting the removal of ChildChannelExecutor
This commit is contained in:
parent
a9e3951adb
commit
67818b4a53
@ -30,6 +30,8 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jboss.netty.channel.Channel;
|
||||
import org.jboss.netty.channel.ChannelEvent;
|
||||
import org.jboss.netty.channel.ChannelState;
|
||||
import org.jboss.netty.channel.ChannelStateEvent;
|
||||
import org.jboss.netty.util.ObjectSizeEstimator;
|
||||
import org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap;
|
||||
|
||||
@ -167,6 +169,15 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
|
||||
executor = oldExecutor;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the entry when the channel closes.
|
||||
if (e instanceof ChannelStateEvent) {
|
||||
ChannelStateEvent se = (ChannelStateEvent) e;
|
||||
if (se.getState() == ChannelState.OPEN &&
|
||||
!channel.isOpen()) {
|
||||
childExecutors.remove(channel);
|
||||
}
|
||||
}
|
||||
return executor;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user