Home / Function/ testCurrentThreadGroupIsUsed() — netty Function Reference

testCurrentThreadGroupIsUsed() — netty Function Reference

Architecture documentation for the testCurrentThreadGroupIsUsed() function in DefaultThreadFactoryTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ec6bff32_9e31_5571_2d1a_a9ce2f8161cf["testCurrentThreadGroupIsUsed()"]
  eaa6bd91_82d8_cddc_06fc_0aeeb341228a["DefaultThreadFactoryTest"]
  ec6bff32_9e31_5571_2d1a_a9ce2f8161cf -->|defined in| eaa6bd91_82d8_cddc_06fc_0aeeb341228a
  style ec6bff32_9e31_5571_2d1a_a9ce2f8161cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/concurrent/DefaultThreadFactoryTest.java lines 268–296

    @Test
    @Timeout(value = 2000, unit = TimeUnit.MILLISECONDS)
    public void testCurrentThreadGroupIsUsed() throws InterruptedException {
        final AtomicReference<DefaultThreadFactory> factory = new AtomicReference<DefaultThreadFactory>();
        final AtomicReference<ThreadGroup> firstCaptured = new AtomicReference<ThreadGroup>();

        final ThreadGroup group = new ThreadGroup("first");
        final Thread first = new Thread(group, new Runnable() {
            @Override
            public void run() {
                final Thread current = Thread.currentThread();
                firstCaptured.set(current.getThreadGroup());
                factory.set(new DefaultThreadFactory("sticky", false));
            }
        });
        first.start();
        first.join();
        assertEquals(group, firstCaptured.get());

        ThreadGroup currentThreadGroup = Thread.currentThread().getThreadGroup();
        Thread second = factory.get().newThread(new Runnable() {
            @Override
            public void run() {
                // NOOP.
            }
        });
        second.join();
        assertEquals(currentThreadGroup, currentThreadGroup);
    }

Domain

Subdomains

Frequently Asked Questions

What does testCurrentThreadGroupIsUsed() do?
testCurrentThreadGroupIsUsed() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/concurrent/DefaultThreadFactoryTest.java.
Where is testCurrentThreadGroupIsUsed() defined?
testCurrentThreadGroupIsUsed() is defined in common/src/test/java/io/netty/util/concurrent/DefaultThreadFactoryTest.java at line 268.

Analyze Your Own Codebase

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

Try Supermodel Free