@@ -69,18 +69,16 @@ public TransportStats(StreamInput in) throws IOException {
6969 rxSize = in .readVLong ();
7070 txCount = in .readVLong ();
7171 txSize = in .readVLong ();
72- if (in .getTransportVersion ().onOrAfter (TransportVersions .V_8_1_0 ) && in .readBoolean ()) {
73- inboundHandlingTimeBucketFrequencies = new long [HandlingTimeTracker .BUCKET_COUNT ];
74- for (int i = 0 ; i < inboundHandlingTimeBucketFrequencies .length ; i ++) {
75- inboundHandlingTimeBucketFrequencies [i ] = in .readVLong ();
76- }
77- outboundHandlingTimeBucketFrequencies = new long [HandlingTimeTracker .BUCKET_COUNT ];
78- for (int i = 0 ; i < inboundHandlingTimeBucketFrequencies .length ; i ++) {
79- outboundHandlingTimeBucketFrequencies [i ] = in .readVLong ();
80- }
81- } else {
82- inboundHandlingTimeBucketFrequencies = new long [0 ];
83- outboundHandlingTimeBucketFrequencies = new long [0 ];
72+ if (in .getTransportVersion ().before (TransportVersions .TRANSPORT_STATS_HANDLING_TIME_REQUIRED )) {
73+ in .readBoolean ();
74+ }
75+ inboundHandlingTimeBucketFrequencies = new long [HandlingTimeTracker .BUCKET_COUNT ];
76+ for (int i = 0 ; i < inboundHandlingTimeBucketFrequencies .length ; i ++) {
77+ inboundHandlingTimeBucketFrequencies [i ] = in .readVLong ();
78+ }
79+ outboundHandlingTimeBucketFrequencies = new long [HandlingTimeTracker .BUCKET_COUNT ];
80+ for (int i = 0 ; i < inboundHandlingTimeBucketFrequencies .length ; i ++) {
81+ outboundHandlingTimeBucketFrequencies [i ] = in .readVLong ();
8482 }
8583 if (in .getTransportVersion ().onOrAfter (TransportVersions .V_8_8_0 )) {
8684 transportActionStats = Collections .unmodifiableMap (in .readOrderedMap (StreamInput ::readString , TransportActionStats ::new ));
@@ -98,15 +96,15 @@ public void writeTo(StreamOutput out) throws IOException {
9896 out .writeVLong (rxSize );
9997 out .writeVLong (txCount );
10098 out .writeVLong (txSize );
101- if ( out . getTransportVersion (). onOrAfter ( TransportVersions . V_8_1_0 )) {
102- assert ( inboundHandlingTimeBucketFrequencies . length > 0 ) == ( outboundHandlingTimeBucketFrequencies . length > 0 );
99+ assert ( inboundHandlingTimeBucketFrequencies . length > 0 ) == ( outboundHandlingTimeBucketFrequencies . length > 0 );
100+ if ( out . getTransportVersion (). before ( TransportVersions . TRANSPORT_STATS_HANDLING_TIME_REQUIRED )) {
103101 out .writeBoolean (inboundHandlingTimeBucketFrequencies .length > 0 );
104- for ( long handlingTimeBucketFrequency : inboundHandlingTimeBucketFrequencies ) {
105- out . writeVLong ( handlingTimeBucketFrequency );
106- }
107- for ( long handlingTimeBucketFrequency : outboundHandlingTimeBucketFrequencies ) {
108- out . writeVLong ( handlingTimeBucketFrequency );
109- }
102+ }
103+ for ( long handlingTimeBucketFrequency : inboundHandlingTimeBucketFrequencies ) {
104+ out . writeVLong ( handlingTimeBucketFrequency );
105+ }
106+ for ( long handlingTimeBucketFrequency : outboundHandlingTimeBucketFrequencies ) {
107+ out . writeVLong ( handlingTimeBucketFrequency );
110108 }
111109 if (out .getTransportVersion ().onOrAfter (TransportVersions .V_8_8_0 )) {
112110 out .writeMap (transportActionStats , StreamOutput ::writeWriteable );
0 commit comments