dugenkui03 opened a new issue #4087:
URL: https://github.com/apache/rocketmq/issues/4087


   ```java
       private DefaultMQProducer getAndCreateTraceProducer(RPCHook rpcHook) {
           DefaultMQProducer traceProducerInstance = this.traceProducer;
           if (traceProducerInstance == null) {
               traceProducerInstance = new DefaultMQProducer(rpcHook);
               // _INNER_TRACE_PRODUCER-${group}-${type}-${counter}
               traceProducerInstance.setProducerGroup(genGroupNameForTrace());
               traceProducerInstance.setSendMsgTimeout(5000);
               traceProducerInstance.setVipChannelEnabled(false);
               // The max size of message is 128K
               traceProducerInstance.setMaxMessageSize(maxMsgSize - 10 * 1000);
           }
           return traceProducerInstance;
       }
   ```
   
   Now, `#getAndCreateTraceProducer` is only invoked by constroctor for 
initializing `traceProducer`.
   
   Even though `#getAndCreateTraceProducer` is invoked elsewhere, 
`traceProducer` is already initialized when `AsyncTraceDispatcher` instance is 
cteated, `#getAndCreateTraceProducer` just return the created traceProducer and 
`#getTraceProducer` is more clearly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to