Home / Function/ testIsTextMultiThreaded() — netty Function Reference

testIsTextMultiThreaded() — netty Function Reference

Architecture documentation for the testIsTextMultiThreaded() function in ByteBufUtilTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b1d21b90_97af_4de7_85b6_bab408943639["testIsTextMultiThreaded()"]
  1b32157c_4c5c_4c3c_706b_1a74a9afdca7["ByteBufUtilTest"]
  b1d21b90_97af_4de7_85b6_bab408943639 -->|defined in| 1b32157c_4c5c_4c3c_706b_1a74a9afdca7
  style b1d21b90_97af_4de7_85b6_bab408943639 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java lines 997–1037

    @ParameterizedTest(name = PARAMETERIZED_NAME)
    @MethodSource("noUnsafe")
    public void testIsTextMultiThreaded(BufferType bufferType) throws Throwable {
        assumeTrue(bufferType == BufferType.HEAP_UNPOOLED);
        final ByteBuf buffer = Unpooled.copiedBuffer("Hello, World!", CharsetUtil.ISO_8859_1);

        try {
            final AtomicInteger counter = new AtomicInteger(60000);
            final AtomicReference<Throwable> errorRef = new AtomicReference<Throwable>();
            List<Thread> threads = new ArrayList<Thread>();
            for (int i = 0; i < 10; i++) {
                Thread thread = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            while (errorRef.get() == null && counter.decrementAndGet() > 0) {
                                assertTrue(ByteBufUtil.isText(buffer, CharsetUtil.ISO_8859_1));
                            }
                        } catch (Throwable cause) {
                            errorRef.compareAndSet(null, cause);
                        }
                    }
                });
                threads.add(thread);
            }
            for (Thread thread : threads) {
                thread.start();
            }

            for (Thread thread : threads) {
                thread.join();
            }

            Throwable error = errorRef.get();
            if (error != null) {
                throw error;
            }
        } finally {
            buffer.release();
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does testIsTextMultiThreaded() do?
testIsTextMultiThreaded() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java.
Where is testIsTextMultiThreaded() defined?
testIsTextMultiThreaded() is defined in buffer/src/test/java/io/netty/buffer/ByteBufUtilTest.java at line 997.

Analyze Your Own Codebase

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

Try Supermodel Free