Improve Javadoc for DefaultCacheAwareContextLoaderDelegate

See gh-14182
This commit is contained in:
Sam Brannen 2023-06-09 14:50:54 +02:00
parent 56f3bd86cf
commit c8bb7ded5d
1 changed files with 18 additions and 9 deletions

View File

@ -43,7 +43,7 @@ import org.springframework.test.context.util.TestContextSpringFactoriesUtils;
import org.springframework.util.Assert; import org.springframework.util.Assert;
/** /**
* Default implementation of the {@link CacheAwareContextLoaderDelegate} interface. * Default implementation of the {@link CacheAwareContextLoaderDelegate} strategy.
* *
* <p>To use a static {@link DefaultContextCache}, invoke the * <p>To use a static {@link DefaultContextCache}, invoke the
* {@link #DefaultCacheAwareContextLoaderDelegate()} constructor; otherwise, * {@link #DefaultCacheAwareContextLoaderDelegate()} constructor; otherwise,
@ -55,6 +55,11 @@ import org.springframework.util.Assert;
* SpringFactoriesLoader} mechanism and delegates to them in * SpringFactoriesLoader} mechanism and delegates to them in
* {@link #loadContext(MergedContextConfiguration)} to process context load failures. * {@link #loadContext(MergedContextConfiguration)} to process context load failures.
* *
* <p>As of Spring Framework 6.1, this class supports the <em>failure threshold</em>
* feature described in {@link CacheAwareContextLoaderDelegate#loadContext},
* delegating to {@link ContextCacheUtils#retrieveContextFailureThreshold()} to
* obtain the threshold value to use.
*
* @author Sam Brannen * @author Sam Brannen
* @since 4.1 * @since 4.1
*/ */
@ -90,11 +95,11 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
/** /**
* Construct a new {@code DefaultCacheAwareContextLoaderDelegate} using * Construct a new {@code DefaultCacheAwareContextLoaderDelegate} using a
* a static {@link DefaultContextCache}. * static {@link DefaultContextCache}.
* <p>This default cache is static so that each context can be cached * <p>The default cache is static so that each context can be cached and
* and reused for all subsequent tests that declare the same unique * reused for all subsequent tests that declare the same unique context
* context configuration within the same JVM process. * configuration within the same JVM process.
* @see #DefaultCacheAwareContextLoaderDelegate(ContextCache) * @see #DefaultCacheAwareContextLoaderDelegate(ContextCache)
*/ */
public DefaultCacheAwareContextLoaderDelegate() { public DefaultCacheAwareContextLoaderDelegate() {
@ -102,18 +107,22 @@ public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContext
} }
/** /**
* Construct a new {@code DefaultCacheAwareContextLoaderDelegate} using * Construct a new {@code DefaultCacheAwareContextLoaderDelegate} using the
* the supplied {@link ContextCache}. * supplied {@link ContextCache} and the default or user-configured context
* failure threshold.
* @see #DefaultCacheAwareContextLoaderDelegate() * @see #DefaultCacheAwareContextLoaderDelegate()
* @see ContextCacheUtils#retrieveContextFailureThreshold()
*/ */
public DefaultCacheAwareContextLoaderDelegate(ContextCache contextCache) { public DefaultCacheAwareContextLoaderDelegate(ContextCache contextCache) {
this(contextCache, ContextCacheUtils.retrieveContextFailureThreshold()); this(contextCache, ContextCacheUtils.retrieveContextFailureThreshold());
} }
/** /**
* Construct a new {@code DefaultCacheAwareContextLoaderDelegate} using the
* supplied {@link ContextCache} and context failure threshold.
* @since 6.1 * @since 6.1
*/ */
DefaultCacheAwareContextLoaderDelegate(ContextCache contextCache, int failureThreshold) { private DefaultCacheAwareContextLoaderDelegate(ContextCache contextCache, int failureThreshold) {
Assert.notNull(contextCache, "ContextCache must not be null"); Assert.notNull(contextCache, "ContextCache must not be null");
Assert.isTrue(failureThreshold > 0, "'failureThreshold' must be positive"); Assert.isTrue(failureThreshold > 0, "'failureThreshold' must be positive");
this.contextCache = contextCache; this.contextCache = contextCache;