Home / Function/ testCleanup() — netty Function Reference

testCleanup() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

common/src/test/java/io/netty/util/internal/ObjectCleanerTest.java lines 36–71

    @Test
    @Timeout(value = 5000, unit = TimeUnit.MILLISECONDS)
    public void testCleanup() throws Exception {
        final AtomicBoolean freeCalled = new AtomicBoolean();
        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();
        ObjectCleaner.register(temporaryThread, new Runnable() {
            @Override
            public void run() {
                freeCalled.set(true);
            }
        });

        latch.countDown();
        temporaryThread.join();
        assertFalse(freeCalled.get());

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

        while (!freeCalled.get()) {
            System.gc();
            System.runFinalization();
            Thread.sleep(100);
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free