未验证 提交 0de4038f 编写于 作者: Z zhangjidi2016 提交者: GitHub

[ISSUE #3361]DefaultMQProducer's constructor can call the overloaded constructor. (#3362)

Co-authored-by: Nzhangjidi <zhangjidi@cmss.chinamobile.com>
上级 a9ae546b
...@@ -158,22 +158,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer { ...@@ -158,22 +158,7 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
*/ */
public DefaultMQProducer(final String producerGroup, RPCHook rpcHook, boolean enableMsgTrace, public DefaultMQProducer(final String producerGroup, RPCHook rpcHook, boolean enableMsgTrace,
final String customizedTraceTopic) { final String customizedTraceTopic) {
this.producerGroup = producerGroup; this(null, producerGroup, rpcHook, enableMsgTrace, customizedTraceTopic);
defaultMQProducerImpl = new DefaultMQProducerImpl(this, rpcHook);
//if client open the message trace feature
if (enableMsgTrace) {
try {
AsyncTraceDispatcher dispatcher = new AsyncTraceDispatcher(producerGroup, TraceDispatcher.Type.PRODUCE, customizedTraceTopic, rpcHook);
dispatcher.setHostProducer(this.defaultMQProducerImpl);
traceDispatcher = dispatcher;
this.defaultMQProducerImpl.registerSendMessageHook(
new SendMessageTraceHookImpl(traceDispatcher));
this.defaultMQProducerImpl.registerEndTransactionHook(
new EndTransactionTraceHookImpl(traceDispatcher));
} catch (Throwable e) {
log.error("system mqtrace hook init failed ,maybe can't send msg trace data");
}
}
} }
/** /**
...@@ -251,9 +236,9 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer { ...@@ -251,9 +236,9 @@ public class DefaultMQProducer extends ClientConfig implements MQProducer {
if (enableMsgTrace) { if (enableMsgTrace) {
try { try {
AsyncTraceDispatcher dispatcher = new AsyncTraceDispatcher(producerGroup, TraceDispatcher.Type.PRODUCE, customizedTraceTopic, rpcHook); AsyncTraceDispatcher dispatcher = new AsyncTraceDispatcher(producerGroup, TraceDispatcher.Type.PRODUCE, customizedTraceTopic, rpcHook);
dispatcher.setHostProducer(this.getDefaultMQProducerImpl()); dispatcher.setHostProducer(this.defaultMQProducerImpl);
traceDispatcher = dispatcher; traceDispatcher = dispatcher;
this.getDefaultMQProducerImpl().registerSendMessageHook( this.defaultMQProducerImpl.registerSendMessageHook(
new SendMessageTraceHookImpl(traceDispatcher)); new SendMessageTraceHookImpl(traceDispatcher));
this.defaultMQProducerImpl.registerEndTransactionHook( this.defaultMQProducerImpl.registerEndTransactionHook(
new EndTransactionTraceHookImpl(traceDispatcher)); new EndTransactionTraceHookImpl(traceDispatcher));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册