@@ -151,14 +151,12 @@ static final class Tracker {
151151 private ScheduledFuture <?> reportTimer ;
152152
153153 void channelActive (Channel channel ) {
154- if (metricRecorder != null ) {
155- List <String > labelValues = getLabelValues (channel );
156- metricRecorder .addLongCounter (metrics .connectionsCreated , 1 ,
157- Collections .emptyList (), labelValues );
158- metricRecorder .addLongUpDownCounter (metrics .connectionCount , 1 ,
159- Collections .emptyList (), labelValues );
160- scheduleNextReport (channel , true );
161- }
154+ List <String > labelValues = getLabelValues (channel );
155+ metricRecorder .addLongCounter (metrics .connectionsCreated , 1 ,
156+ Collections .emptyList (), labelValues );
157+ metricRecorder .addLongUpDownCounter (metrics .connectionCount , 1 ,
158+ Collections .emptyList (), labelValues );
159+ scheduleNextReport (channel , true );
162160 }
163161
164162 private void scheduleNextReport (final Channel channel , boolean isInitial ) {
@@ -188,21 +186,19 @@ void channelInactive(Channel channel) {
188186 if (reportTimer != null ) {
189187 reportTimer .cancel (false );
190188 }
191- if (metricRecorder != null ) {
192- List <String > labelValues = getLabelValues (channel );
193- metricRecorder .addLongUpDownCounter (metrics .connectionCount , -1 ,
194- Collections .emptyList (), labelValues );
195- // Final collection on close
196- recordTcpInfo (channel , true );
197- }
189+ List <String > labelValues = getLabelValues (channel );
190+ metricRecorder .addLongUpDownCounter (metrics .connectionCount , -1 ,
191+ Collections .emptyList (), labelValues );
192+ // Final collection on close
193+ recordTcpInfo (channel , true );
198194 }
199195
200196 void recordTcpInfo (Channel channel ) {
201197 recordTcpInfo (channel , false );
202198 }
203199
204200 private void recordTcpInfo (Channel channel , boolean isClose ) {
205- if (metricRecorder == null || epollSocketChannelClass == null
201+ if (epollSocketChannelClass == null
206202 || !epollSocketChannelClass .isInstance (channel )) {
207203 return ;
208204 }
0 commit comments