Skip to content

Commit

Permalink
#654 Make metric changes thread safe
Browse files Browse the repository at this point in the history
  • Loading branch information
mcweba committed Jan 13, 2025
1 parent cdc3849 commit df9c2ff
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private Future<Void> sendMessage(KafkaProducer<String, String> kafkaProducer, Ka
});
}

private void incrementSuccessCount(String topic) {
private synchronized void incrementSuccessCount(String topic) {
Counter counter = successSendCounterMap.get(topic);
if(counter != null) {
counter.increment();
Expand All @@ -88,7 +88,7 @@ private void incrementSuccessCount(String topic) {
}
}

private void incrementFailCount1(String topic) {
private synchronized void incrementFailCount1(String topic) {
Counter counter = failSendCounterMap.get(topic);
if(counter != null) {
counter.increment();
Expand Down

0 comments on commit df9c2ff

Please sign in to comment.