testAdaptiveAllocatorEvent() — netty Function Reference
Architecture documentation for the testAdaptiveAllocatorEvent() function in FlightRecorderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 2e642c04_8fa9_492c_c551_57e921ab300f["testAdaptiveAllocatorEvent()"] 5524177b_fab5_a7f3_543b_444503b791cb["FlightRecorderTest"] 2e642c04_8fa9_492c_c551_57e921ab300f -->|defined in| 5524177b_fab5_a7f3_543b_444503b791cb style 2e642c04_8fa9_492c_c551_57e921ab300f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/FlightRecorderTest.java lines 43–71
@EnabledForJreRange(min = JRE.JAVA_17) // RecordingStream
@Timeout(10)
@Test
public void testAdaptiveAllocatorEvent() throws Exception {
ClassLoader cl = ClassLoader.getSystemClassLoader();
Class<?> recordingStreamClass = cl.loadClass("jdk.jfr.consumer.RecordingStream");
Constructor<?> ctor = recordingStreamClass.getConstructor();
Method enableMethod = recordingStreamClass.getMethod("enable", String.class);
Method onEventMethod = recordingStreamClass.getMethod("onEvent", String.class, Consumer.class);
Method startAsyncMethod = recordingStreamClass.getMethod("startAsync");
Object recordingStream = ctor.newInstance();
try (AutoCloseable c = (AutoCloseable) recordingStream) {
CompletableFuture<RecordedEvent> allocateFuture = new CompletableFuture<>();
Consumer<RecordedEvent> complete = allocateFuture::complete;
enableMethod.invoke(recordingStream, "io.netty.AllocateChunk");
onEventMethod.invoke(recordingStream, "io.netty.AllocateChunk", complete);
startAsyncMethod.invoke(recordingStream);
AdaptiveByteBufAllocator alloc = new AdaptiveByteBufAllocator(true, false);
alloc.directBuffer(128).release();
RecordedEvent allocate = allocateFuture.get();
assertTrue(allocate.getBoolean("pooled"));
assertFalse(allocate.getBoolean("threadLocal"));
assertTrue(allocate.getBoolean("direct"));
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testAdaptiveAllocatorEvent() do?
testAdaptiveAllocatorEvent() is a function in the netty codebase, defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/FlightRecorderTest.java.
Where is testAdaptiveAllocatorEvent() defined?
testAdaptiveAllocatorEvent() is defined in testsuite-jpms/src/test/java/io/netty/testsuite_jpms/test/FlightRecorderTest.java at line 43.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free