Home / Function/ testOnRemoveCalled() — netty Function Reference

testOnRemoveCalled() — netty Function Reference

Architecture documentation for the testOnRemoveCalled() function in FastThreadLocalTest.java from the netty codebase.

Function java Buffer Search calls 2 called by 6

Entity Profile

Dependency Diagram

graph TD
  5d954afa_1341_0a60_d012_38880d7a7dee["testOnRemoveCalled()"]
  c9cb652b_4141_8af2_1f8b_c47765bb30f9["FastThreadLocalTest"]
  5d954afa_1341_0a60_d012_38880d7a7dee -->|defined in| c9cb652b_4141_8af2_1f8b_c47765bb30f9
  f1d8a426_b004_5ddf_cc05_0ca4720616cf["testOnRemoveCalledForFastThreadLocalGet()"]
  f1d8a426_b004_5ddf_cc05_0ca4720616cf -->|calls| 5d954afa_1341_0a60_d012_38880d7a7dee
  2477f800_af92_4ac4_8ad4_9b9231b884d9["testOnRemoveCalledForNonFastThreadLocalGet()"]
  2477f800_af92_4ac4_8ad4_9b9231b884d9 -->|calls| 5d954afa_1341_0a60_d012_38880d7a7dee
  874ba961_e3a2_ab5c_db4f_84a905873081["testOnRemoveCalledForFastThreadLocalSet()"]
  874ba961_e3a2_ab5c_db4f_84a905873081 -->|calls| 5d954afa_1341_0a60_d012_38880d7a7dee
  726732d5_35e5_86a7_07cf_73da84faf201["testOnRemoveCalledForNonFastThreadLocalSet()"]
  726732d5_35e5_86a7_07cf_73da84faf201 -->|calls| 5d954afa_1341_0a60_d012_38880d7a7dee
  e12ac4fd_6279_565c_273e_c27ed7d3e3b7["testOnRemoveCalledForWrappedGet()"]
  e12ac4fd_6279_565c_273e_c27ed7d3e3b7 -->|calls| 5d954afa_1341_0a60_d012_38880d7a7dee
  c43bfdfc_7f34_4df2_863b_9eefe68767b3["testOnRemoveCalledForWrappedSet()"]
  c43bfdfc_7f34_4df2_863b_9eefe68767b3 -->|calls| 5d954afa_1341_0a60_d012_38880d7a7dee
  7fb6cd58_f112_73b3_6216_2819f285c975["run()"]
  5d954afa_1341_0a60_d012_38880d7a7dee -->|calls| 7fb6cd58_f112_73b3_6216_2819f285c975
  9937339a_65f9_5ac1_da91_c4ab3f60d753["onRemoval()"]
  5d954afa_1341_0a60_d012_38880d7a7dee -->|calls| 9937339a_65f9_5ac1_da91_c4ab3f60d753
  style 5d954afa_1341_0a60_d012_38880d7a7dee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/concurrent/FastThreadLocalTest.java lines 282–322

    private static void testOnRemoveCalled(boolean fastThreadLocal, boolean wrap, final boolean callGet)
            throws Exception {

        final TestFastThreadLocal threadLocal = new TestFastThreadLocal();
        final TestFastThreadLocal threadLocal2 = new TestFastThreadLocal();

        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                if (callGet) {
                    assertEquals(Thread.currentThread().getName(), threadLocal.get());
                    assertEquals(Thread.currentThread().getName(), threadLocal2.get());
                } else {
                    threadLocal.set(Thread.currentThread().getName());
                    threadLocal2.set(Thread.currentThread().getName());
                }
            }
        };
        if (wrap) {
            Runnable r = runnable;
            runnable = () -> FastThreadLocalThread.runWithFastThreadLocal(r);
        }
        Thread thread = fastThreadLocal ? new FastThreadLocalThread(runnable) : new Thread(runnable);
        thread.start();
        thread.join();

        String threadName = thread.getName();

        // Null this out so it can be collected
        thread = null;

        // Loop until onRemoval(...) was called. This will fail the test if this not works due a timeout.
        while (threadLocal.onRemovalCalled.get() == null || threadLocal2.onRemovalCalled.get() == null) {
            System.gc();
            System.runFinalization();
            Thread.sleep(50);
        }

        assertEquals(threadName, threadLocal.onRemovalCalled.get());
        assertEquals(threadName, threadLocal2.onRemovalCalled.get());
    }

Domain

Subdomains

Frequently Asked Questions

What does testOnRemoveCalled() do?
testOnRemoveCalled() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/FastThreadLocalTest.java.
Where is testOnRemoveCalled() defined?
testOnRemoveCalled() is defined in common/src/test/java/io/netty/util/concurrent/FastThreadLocalTest.java at line 282.
What does testOnRemoveCalled() call?
testOnRemoveCalled() calls 2 function(s): onRemoval, run.
What calls testOnRemoveCalled()?
testOnRemoveCalled() is called by 6 function(s): testOnRemoveCalledForFastThreadLocalGet, testOnRemoveCalledForFastThreadLocalSet, testOnRemoveCalledForNonFastThreadLocalGet, testOnRemoveCalledForNonFastThreadLocalSet, testOnRemoveCalledForWrappedGet, testOnRemoveCalledForWrappedSet.

Analyze Your Own Codebase

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

Try Supermodel Free