Change whitelist fields from static to instance

This commit is contained in:
Laplie Anderson 2019-08-27 12:06:01 -04:00
parent d170984f72
commit 7a41ca7d6e
1 changed files with 6 additions and 8 deletions

View File

@ -22,22 +22,24 @@ public abstract class AbstractExecutorInstrumentation extends Instrumenter.Defau
public static final String EXEC_NAME = "java_concurrent";
private static final boolean TRACE_ALL_EXECUTORS = Config.get().isTraceExecutorsAll();
private final boolean TRACE_ALL_EXECUTORS = Config.get().isTraceExecutorsAll();
/**
* Only apply executor instrumentation to whitelisted executors. To apply to all executors, use
* override setting above.
*/
private static final Collection<String> WHITELISTED_EXECUTORS;
private final Collection<String> WHITELISTED_EXECUTORS;
/**
* Some frameworks have their executors defined as anon classes inside other classes. Referencing
* anon classes by name would be fragile, so instead we will use list of class prefix names. Since
* checking this list is more expensive (O(n)) we should try to keep it short.
*/
private static final Collection<String> WHITELISTED_EXECUTORS_PREFIXES;
private final Collection<String> WHITELISTED_EXECUTORS_PREFIXES;
public AbstractExecutorInstrumentation(final String... additionalNames) {
super(EXEC_NAME, additionalNames);
static {
if (TRACE_ALL_EXECUTORS) {
log.info("Tracing all executors enabled.");
WHITELISTED_EXECUTORS = Collections.emptyList();
@ -96,10 +98,6 @@ public abstract class AbstractExecutorInstrumentation extends Instrumenter.Defau
}
}
public AbstractExecutorInstrumentation(final String... additionalNames) {
super(EXEC_NAME, additionalNames);
}
@Override
public ElementMatcher<TypeDescription> typeMatcher() {
final ElementMatcher.Junction<TypeDescription> matcher =