Search in sources :

Example 1 with ThreadLeakFilters

use of com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters in project randomizedtesting by randomizedtesting.

the class ThreadLeakControl method instantiateFilters.

/**
   * Instantiate a full set of {@link ThreadFilter}s for a suite.
   */
private ThreadFilter instantiateFilters(List<Throwable> errors, Class<?> suiteClass) {
    ThreadLeakFilters ann = firstAnnotated(ThreadLeakFilters.class, suiteClass, DefaultAnnotationValues.class);
    final ArrayList<ThreadFilter> filters = new ArrayList<ThreadFilter>();
    for (Class<? extends ThreadFilter> c : ann.filters()) {
        try {
            filters.add(c.newInstance());
        } catch (Throwable t) {
            errors.add(t);
        }
    }
    if (ann.defaultFilters()) {
        filters.addAll(builtinFilters);
    }
    return or(filters.toArray(new ThreadFilter[filters.size()]));
}
Also used : ArrayList(java.util.ArrayList) ThreadLeakFilters(com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters)

Aggregations

ThreadLeakFilters (com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters)1 ArrayList (java.util.ArrayList)1