2121import  java .util .List ;
2222import  java .util .Map ;
2323import  java .util .Set ;
24+ import  java .util .concurrent .ConcurrentHashMap ;
2425import  java .util .concurrent .atomic .AtomicInteger ;
2526
2627import  org .apache .commons .logging .Log ;
2728import  org .apache .commons .logging .LogFactory ;
29+ 
2830import  org .springframework .context .ApplicationContext ;
2931import  org .springframework .context .ConfigurableApplicationContext ;
3032import  org .springframework .core .style .ToStringCreator ;
3133import  org .springframework .test .annotation .DirtiesContext .HierarchyMode ;
3234import  org .springframework .test .context .ContextCache ;
3335import  org .springframework .test .context .MergedContextConfiguration ;
3436import  org .springframework .util .Assert ;
35- import  org .springframework .util .ConcurrentReferenceHashMap ;
3637
3738/** 
3839 * Default implementation of the {@link ContextCache} API. 
3940 * 
40-  * <p>Uses Spring's {@link ConcurrentReferenceHashMap} to store 
41-  * {@linkplain java.lang.ref.SoftReference soft references} to cached 
42-  * contexts and {@code MergedContextConfiguration} instances. 
41+  * <p>Uses {@link ConcurrentHashMap ConcurrentHashMaps} to cache 
42+  * {@link ApplicationContext} and {@link MergedContextConfiguration} instances. 
4343 * 
4444 * @author Sam Brannen 
4545 * @author Juergen Hoeller 
4646 * @since 2.5 
47-  * @see ConcurrentReferenceHashMap 
4847 */ 
4948public  class  DefaultContextCache  implements  ContextCache  {
5049
@@ -54,7 +53,7 @@ public class DefaultContextCache implements ContextCache {
5453	 * Map of context keys to Spring {@code ApplicationContext} instances. 
5554	 */ 
5655	private  final  Map <MergedContextConfiguration , ApplicationContext > contextMap  =
57- 			new  ConcurrentReferenceHashMap <MergedContextConfiguration , ApplicationContext >(64 );
56+ 			new  ConcurrentHashMap <MergedContextConfiguration , ApplicationContext >(64 );
5857
5958	/** 
6059	 * Map of parent keys to sets of children keys, representing a top-down <em>tree</em> 
@@ -63,7 +62,7 @@ public class DefaultContextCache implements ContextCache {
6362	 * of other contexts. 
6463	 */ 
6564	private  final  Map <MergedContextConfiguration , Set <MergedContextConfiguration >> hierarchyMap  =
66- 			new  ConcurrentReferenceHashMap <MergedContextConfiguration , Set <MergedContextConfiguration >>(64 );
65+ 			new  ConcurrentHashMap <MergedContextConfiguration , Set <MergedContextConfiguration >>(64 );
6766
6867	private  final  AtomicInteger  hitCount  = new  AtomicInteger ();
6968
0 commit comments