[ 
https://issues.apache.org/jira/browse/ROCKETMQ-254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16119396#comment-16119396
 ] 

ASF GitHub Bot commented on ROCKETMQ-254:
-----------------------------------------

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.


> LoggerAppender unit test cost much time and sometimes test failure
> ------------------------------------------------------------------
>
>                 Key: ROCKETMQ-254
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-254
>             Project: Apache RocketMQ
>          Issue Type: Bug
>          Components: rocketmq-client
>    Affects Versions: 4.1.0-incubating
>            Reporter: lindzh
>            Assignee: Xiaorui Wang
>             Fix For: 4.2.0-incubating
>
>
> LoggerAppender unit test cost much time, and in some cases it may cause test 
> failure,fix this case this mockito.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to