Polishing

This commit is contained in:
Sam Brannen
2023-06-08 15:40:27 +02:00
parent d7970e4ab8
commit e32a92daa7
2 changed files with 8 additions and 5 deletions

View File

@@ -66,7 +66,8 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
*/
static final ContextCache defaultContextCache = new DefaultContextCache();
private List<ApplicationContextFailureProcessor> contextFailureProcessors = TestContextSpringFactoriesUtils
private final List<ApplicationContextFailureProcessor> contextFailureProcessors = TestContextSpringFactoriesUtils
.loadFactoryImplementations(ApplicationContextFailureProcessor.class);
private final AotTestContextInitializers aotTestContextInitializers = new AotTestContextInitializers();
@@ -99,8 +100,9 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
@Override
public boolean isContextLoaded(MergedContextConfiguration mergedContextConfiguration) {
mergedContextConfiguration = replaceIfNecessary(mergedContextConfiguration);
synchronized (this.contextCache) {
return this.contextCache.contains(replaceIfNecessary(mergedContextConfiguration));
return this.contextCache.contains(mergedContextConfiguration);
}
}
@@ -158,8 +160,9 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
@Override
public void closeContext(MergedContextConfiguration mergedContextConfiguration, @Nullable HierarchyMode hierarchyMode) {
mergedContextConfiguration = replaceIfNecessary(mergedContextConfiguration);
synchronized (this.contextCache) {
this.contextCache.remove(replaceIfNecessary(mergedContextConfiguration), hierarchyMode);
this.contextCache.remove(mergedContextConfiguration, hierarchyMode);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -158,7 +158,7 @@ public class DefaultContextCache implements ContextCache {
Assert.notNull(key, "Key must not be null");
// startKey is the level at which to begin clearing the cache,
// depending on the configured hierarchy mode.s
// depending on the configured hierarchy mode.
MergedContextConfiguration startKey = key;
if (hierarchyMode == HierarchyMode.EXHAUSTIVE) {
MergedContextConfiguration parent = startKey.getParent();