Skip to content

Commit

Permalink
Fix a reace condition caused by one thread calls getMapper method whi…
Browse files Browse the repository at this point in the history
…le other threads calling addMapper

fix the issue 2890: mybatis#2890
  • Loading branch information
uniquewings committed Jul 10, 2023
1 parent 338f54b commit 3b27083
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/apache/ibatis/binding/MapperRegistry.java
Expand Up @@ -17,9 +17,9 @@

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.ibatis.builder.annotation.MapperAnnotationBuilder;
import org.apache.ibatis.io.ResolverUtil;
Expand All @@ -34,7 +34,7 @@
public class MapperRegistry {

private final Configuration config;
private final Map<Class<?>, MapperProxyFactory<?>> knownMappers = new HashMap<>();
private final Map<Class<?>, MapperProxyFactory<?>> knownMappers = new ConcurrentHashMap<>();

public MapperRegistry(Configuration config) {
this.config = config;
Expand Down

0 comments on commit 3b27083

Please sign in to comment.