Home / Function/ testCleanupContinuesDespiteThrowing() — netty Function Reference

testCleanupContinuesDespiteThrowing() — netty Function Reference

Architecture documentation for the testCleanupContinuesDespiteThrowing() function in ObjectCleanerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  3e50e3be_f721_6ed4_5011_ee5aa675253f["testCleanupContinuesDespiteThrowing()"]
  6ab8958b_bdc7_6dbd_0fac_3c76aea02daf["ObjectCleanerTest"]
  3e50e3be_f721_6ed4_5011_ee5aa675253f -->|defined in| 6ab8958b_bdc7_6dbd_0fac_3c76aea02daf
  style 3e50e3be_f721_6ed4_5011_ee5aa675253f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/internal/ObjectCleanerTest.java lines 73–118

    @Test
    @Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
    public void testCleanupContinuesDespiteThrowing() throws InterruptedException {
        final AtomicInteger freeCalledCount = new AtomicInteger();
        final CountDownLatch latch = new CountDownLatch(1);
        temporaryThread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    latch.await();
                } catch (InterruptedException ignore) {
                    // just ignore
                }
            }
        });
        temporaryThread.start();
        temporaryObject = new Object();
        ObjectCleaner.register(temporaryThread, new Runnable() {
            @Override
            public void run() {
                freeCalledCount.incrementAndGet();
                throw new RuntimeException("expected");
            }
        });
        ObjectCleaner.register(temporaryObject, new Runnable() {
            @Override
            public void run() {
                freeCalledCount.incrementAndGet();
                throw new RuntimeException("expected");
            }
        });

        latch.countDown();
        temporaryThread.join();
        assertEquals(0, freeCalledCount.get());

        // Null out the temporary object to ensure it is enqueued for GC.
        temporaryThread = null;
        temporaryObject = null;

        while (freeCalledCount.get() != 2) {
            System.gc();
            System.runFinalization();
            Thread.sleep(100);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testCleanupContinuesDespiteThrowing() do?
testCleanupContinuesDespiteThrowing() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/internal/ObjectCleanerTest.java.
Where is testCleanupContinuesDespiteThrowing() defined?
testCleanupContinuesDespiteThrowing() is defined in common/src/test/java/io/netty/util/internal/ObjectCleanerTest.java at line 73.

Analyze Your Own Codebase

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

Try Supermodel Free