Github user shroman commented on a diff in the pull request:

    https://github.com/apache/incubator-rocketmq/pull/141#discussion_r132088233
  
    --- Diff: 
logappender/src/main/java/org/apache/rocketmq/logappender/common/ProducerInstance.java
 ---
    @@ -70,24 +76,28 @@ public static MQProducer getInstance(String 
nameServerAddress, String group) thr
         }
     
     
    -    public static void removeAndClose(String nameServerAddress, String 
group) {
    +    public void removeAndClose(String nameServerAddress, String group) {
             if (group == null) {
                 group = DEFAULT_GROUP;
             }
             String genKey = genKey(nameServerAddress, group);
    -        MQProducer producer = producerMap.remove(genKey);
    +        MQProducer producer = 
getProducerInstance().producerMap.remove(genKey);
     
             if (producer != null) {
                 producer.shutdown();
             }
         }
     
    -    public static void closeAll() {
    -        Set<Map.Entry<String, MQProducer>> entries = 
producerMap.entrySet();
    +    public void closeAll() {
    +        Set<Map.Entry<String, MQProducer>> entries = 
getProducerInstance().producerMap.entrySet();
             for (Map.Entry<String, MQProducer> entry : entries) {
    -            producerMap.remove(entry.getKey());
    +            getProducerInstance().producerMap.remove(entry.getKey());
                 entry.getValue().shutdown();
             }
         }
     
    +    public static void setInstance(ProducerInstance instance1) {
    --- End diff --
    
    looks pretty dangerous to me.
    Especially considering you make it only for tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to