Correctly calculate the initial size of the LinkedHashMap during DefaultChannelGroup.write* (#10055)
Motivation: We should not include the number of ServerChannel that are part of the DefaultChannelGroup when specify the initial size of the LinkedHashMap Modifications: Only use the number of the non ServerChannel Result: Reduce memory-footprint
This commit is contained in:
parent
60082c9553
commit
b1c57257af
@ -267,7 +267,7 @@ public class DefaultChannelGroup extends AbstractSet<Channel> implements Channel
|
||||
}
|
||||
future = voidFuture;
|
||||
} else {
|
||||
Map<Channel, ChannelFuture> futures = new LinkedHashMap<Channel, ChannelFuture>(size());
|
||||
Map<Channel, ChannelFuture> futures = new LinkedHashMap<Channel, ChannelFuture>(nonServerChannels.size());
|
||||
for (Channel c: nonServerChannels.values()) {
|
||||
if (matcher.matches(c)) {
|
||||
futures.put(c, c.write(safeDuplicate(message)));
|
||||
@ -400,7 +400,7 @@ public class DefaultChannelGroup extends AbstractSet<Channel> implements Channel
|
||||
}
|
||||
future = voidFuture;
|
||||
} else {
|
||||
Map<Channel, ChannelFuture> futures = new LinkedHashMap<Channel, ChannelFuture>(size());
|
||||
Map<Channel, ChannelFuture> futures = new LinkedHashMap<Channel, ChannelFuture>(nonServerChannels.size());
|
||||
for (Channel c: nonServerChannels.values()) {
|
||||
if (matcher.matches(c)) {
|
||||
futures.put(c, c.writeAndFlush(safeDuplicate(message)));
|
||||
|
Loading…
Reference in New Issue
Block a user