Home / Class/ TestResourceLeakDetector Class — netty Architecture

TestResourceLeakDetector Class — netty Architecture

Architecture documentation for the TestResourceLeakDetector class in ResourceLeakDetectorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  04e2f9c0_7431_aa73_e4b1_4dd135a647df["TestResourceLeakDetector"]
  2fccec07_7249_763a_4cb2_2f948c47b346["ResourceLeakDetectorTest.java"]
  04e2f9c0_7431_aa73_e4b1_4dd135a647df -->|defined in| 2fccec07_7249_763a_4cb2_2f948c47b346
  59bd423c_fad4_6ee7_a604_937516a6c178["TestResourceLeakDetector()"]
  04e2f9c0_7431_aa73_e4b1_4dd135a647df -->|method| 59bd423c_fad4_6ee7_a604_937516a6c178
  c5c33640_d23f_bf0a_9040_cf8e628a8fda["reportTracedLeak()"]
  04e2f9c0_7431_aa73_e4b1_4dd135a647df -->|method| c5c33640_d23f_bf0a_9040_cf8e628a8fda
  e3a69d06_42e5_2726_1da2_1e8a320a815b["reportUntracedLeak()"]
  04e2f9c0_7431_aa73_e4b1_4dd135a647df -->|method| e3a69d06_42e5_2726_1da2_1e8a320a815b
  119d6354_e016_b3bd_a15a_ebdcf8eb74f7["reportInstancesLeak()"]
  04e2f9c0_7431_aa73_e4b1_4dd135a647df -->|method| 119d6354_e016_b3bd_a15a_ebdcf8eb74f7
  208411f5_8977_c7ea_4030_bb76fedeb300["reportError()"]
  04e2f9c0_7431_aa73_e4b1_4dd135a647df -->|method| 208411f5_8977_c7ea_4030_bb76fedeb300
  7afaf084_f5a6_51cf_c23d_5cc5b361cbd0["assertNoErrors()"]
  04e2f9c0_7431_aa73_e4b1_4dd135a647df -->|method| 7afaf084_f5a6_51cf_c23d_5cc5b361cbd0

Relationship Graph

Source Code

common/src/test/java/io/netty/util/ResourceLeakDetectorTest.java lines 217–247

    private static final class TestResourceLeakDetector<T> extends ResourceLeakDetector<T> {

        private final AtomicReference<Throwable> error = new AtomicReference<Throwable>();

        TestResourceLeakDetector(Class<?> resourceType, int samplingInterval, long maxActive) {
            super(resourceType, samplingInterval, maxActive);
        }

        @Override
        protected void reportTracedLeak(String resourceType, String records) {
            reportError(new AssertionError("Leak reported for '" + resourceType + "':\n" + records));
        }

        @Override
        protected void reportUntracedLeak(String resourceType) {
            reportError(new AssertionError("Leak reported for '" + resourceType + '\''));
        }

        @Override
        protected void reportInstancesLeak(String resourceType) {
            reportError(new AssertionError("Leak reported for '" + resourceType + '\''));
        }

        private void reportError(AssertionError cause) {
            error.compareAndSet(null, cause);
        }

        void assertNoErrors() throws Throwable {
            ResourceLeakDetectorTest.assertNoErrors(error);
        }
    }

Frequently Asked Questions

What is the TestResourceLeakDetector class?
TestResourceLeakDetector is a class in the netty codebase, defined in common/src/test/java/io/netty/util/ResourceLeakDetectorTest.java.
Where is TestResourceLeakDetector defined?
TestResourceLeakDetector is defined in common/src/test/java/io/netty/util/ResourceLeakDetectorTest.java at line 217.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free