Skip to content

Commit

Permalink
Convert hashmap to concurrenthashmap in TransactionManagerUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffxiang committed Oct 23, 2024
1 parent 2295af3 commit 642adfd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import com.pinterest.psc.producer.transaction.kafka.KafkaTransactionManagerOperator;
import org.apache.kafka.clients.producer.internals.TransactionManager;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Future;

/**
Expand All @@ -21,7 +21,7 @@
*/
public class TransactionManagerUtils {

private static final Map<String, TransactionManagerOperator> TXN_MANAGER_CLASSNAME_TO_OPERATOR = new HashMap<>();
private static final Map<String, TransactionManagerOperator> TXN_MANAGER_CLASSNAME_TO_OPERATOR = new ConcurrentHashMap<>();

private static TransactionManagerOperator getOrCreateTransactionManagerOperator(Object transactionManager) {
return TXN_MANAGER_CLASSNAME_TO_OPERATOR.computeIfAbsent(transactionManager.getClass().getName(), className -> {
Expand Down

0 comments on commit 642adfd

Please sign in to comment.