Home / Function/ testRacingGetAndSet() — netty Function Reference

testRacingGetAndSet() — netty Function Reference

Architecture documentation for the testRacingGetAndSet() function in NettyRuntimeTests.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  ae47057b_ae5b_56d0_505e_850862868238["testRacingGetAndSet()"]
  f8a8d4a2_21ee_fb99_d44b_e7434e8cbd80["NettyRuntimeTests"]
  ae47057b_ae5b_56d0_505e_850862868238 -->|defined in| f8a8d4a2_21ee_fb99_d44b_e7434e8cbd80
  dc2e2d32_6bd0_143d_25aa_c746f2b8409a["Runnable()"]
  ae47057b_ae5b_56d0_505e_850862868238 -->|calls| dc2e2d32_6bd0_143d_25aa_c746f2b8409a
  c66ca834_66fc_0dc3_a0c7_18e526fa3476["await()"]
  ae47057b_ae5b_56d0_505e_850862868238 -->|calls| c66ca834_66fc_0dc3_a0c7_18e526fa3476
  style ae47057b_ae5b_56d0_505e_850862868238 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/test/java/io/netty/util/NettyRuntimeTests.java lines 117–160

    @Test
    public void testRacingGetAndSet() throws InterruptedException {
        final NettyRuntime.AvailableProcessorsHolder holder = new NettyRuntime.AvailableProcessorsHolder();
        final CyclicBarrier barrier = new CyclicBarrier(3);
        final Thread get = new Thread(new Runnable() {
            @Override
            public void run() {
                await(barrier);
                holder.availableProcessors();
                await(barrier);
            }
        });
        get.start();

        final AtomicReference<IllegalStateException> setException = new AtomicReference<IllegalStateException>();
        final Thread set = new Thread(new Runnable() {
            @Override
            public void run() {
                await(barrier);
                try {
                    holder.setAvailableProcessors(2048);
                } catch (final IllegalStateException e) {
                    setException.set(e);
                }
                await(barrier);
            }
        });
        set.start();

        // release the hounds
        await(barrier);

        // wait for the hounds
        await(barrier);

        get.join();
        set.join();

        if (setException.get() == null) {
            assertEquals(2048, holder.availableProcessors());
        } else {
            assertNotNull(setException.get());
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testRacingGetAndSet() do?
testRacingGetAndSet() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/NettyRuntimeTests.java.
Where is testRacingGetAndSet() defined?
testRacingGetAndSet() is defined in common/src/test/java/io/netty/util/NettyRuntimeTests.java at line 117.
What does testRacingGetAndSet() call?
testRacingGetAndSet() calls 2 function(s): Runnable, await.

Analyze Your Own Codebase

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

Try Supermodel Free