Refactor an agent usage, and fix logic issue

This commit is contained in:
Brian Devins-Suresh 2020-02-24 13:11:10 -05:00
parent e65177a143
commit 75af71584c
2 changed files with 6 additions and 5 deletions

View File

@ -133,9 +133,10 @@ public interface Instrumenter {
*/
final ReferenceMatcher muzzle = getInstrumentationMuzzle();
if (null != muzzle) {
final List<Reference.Mismatch> mismatches =
muzzle.getMismatchedReferenceSources(classLoader);
if (mismatches.size() > 0) {
final boolean isMatch = muzzle.matches(classLoader);
if (!isMatch) {
final List<Reference.Mismatch> mismatches =
muzzle.getMismatchedReferenceSources(classLoader);
if (log.isDebugEnabled()) {
log.debug(
"Instrumentation muzzled: {} -- {} on {}",
@ -153,7 +154,7 @@ public interface Instrumenter {
Instrumenter.Default.this.getClass().getName(),
classLoader);
}
return mismatches.size() == 0;
return isMatch;
}
return true;
}

View File

@ -66,7 +66,7 @@ public class ReferenceMatcher
}
mismatchCache.put(loader, mismatches);
return true;
return mismatches.size() == 0;
}
/**