Skip to content

Commit

Permalink
Revert "Fix Concurrent issue of StoreStatsService"
Browse files Browse the repository at this point in the history
This reverts commit fdc6e87.
  • Loading branch information
lizhanhui committed May 28, 2018
1 parent 61009b7 commit 130c85c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.LinkedList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.rocketmq.common.ServiceThread;
Expand All @@ -43,9 +42,9 @@ public class StoreStatsService extends ServiceThread {

private final AtomicLong putMessageFailedTimes = new AtomicLong(0);

private final ConcurrentMap<String, AtomicLong> putMessageTopicTimesTotal =
private final Map<String, AtomicLong> putMessageTopicTimesTotal =
new ConcurrentHashMap<String, AtomicLong>(128);
private final ConcurrentMap<String, AtomicLong> putMessageTopicSizeTotal =
private final Map<String, AtomicLong> putMessageTopicSizeTotal =
new ConcurrentHashMap<String, AtomicLong>(128);

private final AtomicLong getMessageTimesTotalFound = new AtomicLong(0);
Expand Down Expand Up @@ -546,10 +545,7 @@ public AtomicLong getSinglePutMessageTopicSizeTotal(String topic) {
AtomicLong rs = putMessageTopicSizeTotal.get(topic);
if (null == rs) {
rs = new AtomicLong(0);
AtomicLong previous = putMessageTopicSizeTotal.putIfAbsent(topic, rs);
if(previous != null){
rs = previous;
}
putMessageTopicSizeTotal.put(topic, rs);
}
return rs;
}
Expand All @@ -558,10 +554,7 @@ public AtomicLong getSinglePutMessageTopicTimesTotal(String topic) {
AtomicLong rs = putMessageTopicTimesTotal.get(topic);
if (null == rs) {
rs = new AtomicLong(0);
AtomicLong previous = putMessageTopicTimesTotal.putIfAbsent(topic, rs);
if(previous != null){
rs = previous;
}
putMessageTopicTimesTotal.put(topic, rs);
}
return rs;
}
Expand Down

This file was deleted.

0 comments on commit 130c85c

Please sign in to comment.