* Avoid Needless Set Instantiation in InboundMessage * When `features` is empty (when there's no xpack) we constantly and needless instantiated a few objects here for the empty set on every message
This commit is contained in:
parent
0cc94a457d
commit
7f5d40d235
|
@ -101,7 +101,12 @@ public abstract class InboundMessage extends NetworkMessage implements Closeable
|
||||||
if (TransportStatus.isRequest(status)) {
|
if (TransportStatus.isRequest(status)) {
|
||||||
final Set<String> features;
|
final Set<String> features;
|
||||||
if (remoteVersion.onOrAfter(Version.V_6_3_0)) {
|
if (remoteVersion.onOrAfter(Version.V_6_3_0)) {
|
||||||
features = Collections.unmodifiableSet(new TreeSet<>(Arrays.asList(streamInput.readStringArray())));
|
final String[] featuresFound = streamInput.readStringArray();
|
||||||
|
if (featuresFound.length == 0) {
|
||||||
|
features = Collections.emptySet();
|
||||||
|
} else {
|
||||||
|
features = Collections.unmodifiableSet(new TreeSet<>(Arrays.asList(featuresFound)));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
features = Collections.emptySet();
|
features = Collections.emptySet();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue