Polishing

This commit is contained in:
Sam Brannen 2023-06-11 16:32:16 +02:00
parent b4ba80b09e
commit f8a3253d12
3 changed files with 7 additions and 3 deletions

View File

@ -158,6 +158,9 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
this.contextCache.put(mergedConfig, context); this.contextCache.put(mergedConfig, context);
} }
catch (Exception ex) { catch (Exception ex) {
if (logger.isTraceEnabled()) {
logger.trace("Incrementing ApplicationContext failure count for " + mergedConfig);
}
this.contextCache.incrementFailureCount(mergedConfig); this.contextCache.incrementFailureCount(mergedConfig);
Throwable cause = ex; Throwable cause = ex;
if (ex instanceof ContextLoadException cle) { if (ex instanceof ContextLoadException cle) {

View File

@ -57,6 +57,7 @@ public class DefaultContextCache implements ContextCache {
private static final Log statsLogger = LogFactory.getLog(CONTEXT_CACHE_LOGGING_CATEGORY); private static final Log statsLogger = LogFactory.getLog(CONTEXT_CACHE_LOGGING_CATEGORY);
/** /**
* Map of context keys to Spring {@code ApplicationContext} instances. * Map of context keys to Spring {@code ApplicationContext} instances.
*/ */

View File

@ -45,13 +45,13 @@ import static org.springframework.test.context.cache.ContextCacheTestUtils.reset
*/ */
class ContextFailureThresholdTests { class ContextFailureThresholdTests {
private static final AtomicInteger passingLoadCount = new AtomicInteger(0); private static final AtomicInteger passingLoadCount = new AtomicInteger();
private static final AtomicInteger failingLoadCount = new AtomicInteger(0); private static final AtomicInteger failingLoadCount = new AtomicInteger();
@BeforeEach @BeforeEach
@AfterEach @AfterEach
void resetFlag() { void resetTestFixtures() {
resetContextCache(); resetContextCache();
passingLoadCount.set(0); passingLoadCount.set(0);
failingLoadCount.set(0); failingLoadCount.set(0);