Possible NPE during export of communication metrics is fixed
@@ -385,22 +385,6 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
sysLsnrs = new GridMessageListener[GridTopic.values().length];
}
- MetricRegistry ioMetric = ctx.metric().registry(COMM_METRICS);
-
- CommunicationSpi spi = ctx.config().getCommunicationSpi();
-
- ioMetric.register(OUTBOUND_MSG_QUEUE_CNT, spi::getOutboundMessagesQueueSize,
- "Outbound messages queue size.");
-
- ioMetric.register(SENT_MSG_CNT, spi::getSentMessagesCount, "Sent messages count.");
-
- ioMetric.register(SENT_BYTES_CNT, spi::getSentBytesCount, "Sent bytes count.");
-
- ioMetric.register(RCVD_MSGS_CNT, spi::getReceivedMessagesCount,
- "Received messages count.");
-
- ioMetric.register(RCVD_BYTES_CNT, spi::getReceivedBytesCount, "Received bytes count.");
-
retryCnt = ctx.config().getNetworkSendRetryCount();
netTimeoutMs = (int)ctx.config().getNetworkTimeout();
}
@@ -434,6 +418,22 @@ public class GridIoManager extends GridManagerAdapter<CommunicationSpi<Serializa
@Override public void start() throws IgniteCheckedException {
startSpi();
+ MetricRegistry ioMetric = ctx.metric().registry(COMM_METRICS);
+
+ CommunicationSpi spi = ctx.config().getCommunicationSpi();
+
+ ioMetric.register(OUTBOUND_MSG_QUEUE_CNT, spi::getOutboundMessagesQueueSize,
+ "Outbound messages queue size.");
+
+ ioMetric.register(SENT_MSG_CNT, spi::getSentMessagesCount, "Sent messages count.");
+
+ ioMetric.register(SENT_BYTES_CNT, spi::getSentBytesCount, "Sent bytes count.");
+
+ ioMetric.register(RCVD_MSGS_CNT, spi::getReceivedMessagesCount,
+ "Received messages count.");
+
+ ioMetric.register(RCVD_BYTES_CNT, spi::getReceivedBytesCount, "Received bytes count.");
+
getSpi().setListener(commLsnr = new CommunicationListenerEx<Serializable>() {
@Override public void onMessage(UUID nodeId, Serializable msg, IgniteRunnable msgC) {
try {
