提交 1f4b893c 编写于 作者: J Jaskey 提交者: dongeforever

[ROCKETMQ-160]SendHeartBeat may not be logged in the expected period closes...

[ROCKETMQ-160]SendHeartBeat may not be logged in the expected period closes apache/incubator-rocketmq#86
上级 787d1286
...@@ -112,7 +112,7 @@ public class MQClientInstance { ...@@ -112,7 +112,7 @@ public class MQClientInstance {
private final RebalanceService rebalanceService; private final RebalanceService rebalanceService;
private final DefaultMQProducer defaultMQProducer; private final DefaultMQProducer defaultMQProducer;
private final ConsumerStatsManager consumerStatsManager; private final ConsumerStatsManager consumerStatsManager;
private final AtomicLong storeTimesTotal = new AtomicLong(0); private final AtomicLong sendHeartbeatTimesTotal = new AtomicLong(0);
private ServiceState serviceState = ServiceState.CREATE_JUST; private ServiceState serviceState = ServiceState.CREATE_JUST;
private DatagramSocket datagramSocket; private DatagramSocket datagramSocket;
private Random random = new Random(); private Random random = new Random();
...@@ -517,7 +517,8 @@ public class MQClientInstance { ...@@ -517,7 +517,8 @@ public class MQClientInstance {
return; return;
} }
long times = this.storeTimesTotal.getAndIncrement(); if (!this.brokerAddrTable.isEmpty()) {
long times = this.sendHeartbeatTimesTotal.getAndIncrement();
Iterator<Entry<String, HashMap<Long, String>>> it = this.brokerAddrTable.entrySet().iterator(); Iterator<Entry<String, HashMap<Long, String>>> it = this.brokerAddrTable.entrySet().iterator();
while (it.hasNext()) { while (it.hasNext()) {
Entry<String, HashMap<Long, String>> entry = it.next(); Entry<String, HashMap<Long, String>> entry = it.next();
...@@ -545,7 +546,7 @@ public class MQClientInstance { ...@@ -545,7 +546,7 @@ public class MQClientInstance {
} }
} catch (Exception e) { } catch (Exception e) {
if (this.isBrokerInNameServer(addr)) { if (this.isBrokerInNameServer(addr)) {
log.error("send heart beat to broker exception", e); log.info("send heart beat to broker[{} {} {}] failed", brokerName, id, addr);
} else { } else {
log.info("send heart beat to broker[{} {} {}] exception, because the broker not up, forget it", brokerName, log.info("send heart beat to broker[{} {} {}] exception, because the broker not up, forget it", brokerName,
id, addr); id, addr);
...@@ -556,6 +557,7 @@ public class MQClientInstance { ...@@ -556,6 +557,7 @@ public class MQClientInstance {
} }
} }
} }
}
private void uploadFilterClassSource() { private void uploadFilterClassSource() {
Iterator<Entry<String, MQConsumerInner>> it = this.consumerTable.entrySet().iterator(); Iterator<Entry<String, MQConsumerInner>> it = this.consumerTable.entrySet().iterator();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册