diff --git a/agent-module/plugins-test-module/plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/DependencyResolver.java b/agent-module/plugins-test-module/plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/DependencyResolver.java index dd61c60dae8b..066bfe57a36b 100644 --- a/agent-module/plugins-test-module/plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/DependencyResolver.java +++ b/agent-module/plugins-test-module/plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/DependencyResolver.java @@ -61,6 +61,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; /** @@ -95,10 +96,14 @@ public void serviceCreationFailed(Class type, Class impl, Throwable except } private static class TraceRepositoryCache implements RepositoryCache { - private final RepositoryCache delegate = new DefaultRepositoryCache(); + private final RepositoryCache delegate; private final AtomicInteger hit = new AtomicInteger(); private final AtomicInteger miss = new AtomicInteger(); + public TraceRepositoryCache(RepositoryCache delegate) { + this.delegate = Objects.requireNonNull(delegate, "delegate"); + } + @Override public void put(RepositorySystemSession session, Object key, Object data) { if (logger.isInfoEnabled()) { @@ -141,11 +146,12 @@ static DefaultRepositorySystemSession newRepositorySystemSession(RepositorySyste } private static RepositoryCache newRepositoryCache() { + RepositoryCache cache = new DefaultRepositoryCache(); final String enableTraceCache = System.getProperty("pinpoint.ittest.tracecache", "false"); if (Boolean.parseBoolean(enableTraceCache)) { - return new TraceRepositoryCache(); + return new TraceRepositoryCache(cache); } - return new DefaultRepositoryCache(); + return cache; } private static String resolveLocalRepository() {