diff --git a/psc/src/main/java/com/pinterest/psc/producer/transaction/TransactionManagerUtils.java b/psc/src/main/java/com/pinterest/psc/producer/transaction/TransactionManagerUtils.java index 7e39708..938b920 100644 --- a/psc/src/main/java/com/pinterest/psc/producer/transaction/TransactionManagerUtils.java +++ b/psc/src/main/java/com/pinterest/psc/producer/transaction/TransactionManagerUtils.java @@ -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; /** @@ -21,7 +21,7 @@ */ public class TransactionManagerUtils { - private static final Map TXN_MANAGER_CLASSNAME_TO_OPERATOR = new HashMap<>(); + private static final Map TXN_MANAGER_CLASSNAME_TO_OPERATOR = new ConcurrentHashMap<>(); private static TransactionManagerOperator getOrCreateTransactionManagerOperator(Object transactionManager) { return TXN_MANAGER_CLASSNAME_TO_OPERATOR.computeIfAbsent(transactionManager.getClass().getName(), className -> {