Skip to content

Commit

Permalink
IOC容器中,把HashMap改为了ConcurrentHashMap
Browse files Browse the repository at this point in the history
HashMap是线程不安全的,在Web容器高并发环境下会产生线程安全问题,因此把HashMap改为了ConcurrentHashMap。
  • Loading branch information
windbelike authored Feb 29, 2020
1 parent eb541a1 commit e0e7bcf
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import top.crossoverjie.cicada.base.bean.CicadaBeanFactory;
import top.crossoverjie.cicada.base.log.LoggerBuilder;

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

/**
Expand All @@ -18,7 +18,7 @@ public class CicadaIoc implements CicadaBeanFactory {

private static final Logger LOGGER = LoggerBuilder.getLogger(CicadaIoc.class) ;

private static Map<String,Object> beans = new HashMap<>(16) ;
private static Map<String,Object> beans = new ConcurrentHashMap<>(16) ;

@Override
public void register(Object object) {
Expand Down

0 comments on commit e0e7bcf

Please sign in to comment.