testRecycleAtTwoThreadsMulti() — netty Function Reference
Architecture documentation for the testRecycleAtTwoThreadsMulti() function in RecyclerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3bd7460f_f143_75fb_21d2_0c342e7eabc0["testRecycleAtTwoThreadsMulti()"] 46ac14b1_2382_5afa_98f3_803182070b38["RecyclerTest"] 3bd7460f_f143_75fb_21d2_0c342e7eabc0 -->|defined in| 46ac14b1_2382_5afa_98f3_803182070b38 87dca999_f804_a974_e326_fd8f527f1246["newRecycler()"] 3bd7460f_f143_75fb_21d2_0c342e7eabc0 -->|calls| 87dca999_f804_a974_e326_fd8f527f1246 43ab40f6_52e7_0fe9_a79f_220021939268["recycle()"] 3bd7460f_f143_75fb_21d2_0c342e7eabc0 -->|calls| 43ab40f6_52e7_0fe9_a79f_220021939268 style 3bd7460f_f143_75fb_21d2_0c342e7eabc0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
common/src/test/java/io/netty/util/RecyclerTest.java lines 475–516
@ParameterizedTest
@MethodSource("ownerTypeAndUnguarded")
public void testRecycleAtTwoThreadsMulti(OwnerType ownerType, boolean unguarded) throws Exception {
final Recycler<HandledObject> recycler = newRecycler(ownerType, unguarded, 256);
final HandledObject o = recycler.get();
ExecutorService single = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(@NotNull Runnable r) {
return RecyclerTest.this.newThread(r);
}
});
final CountDownLatch latch1 = new CountDownLatch(1);
single.execute(new Runnable() {
@Override
public void run() {
o.recycle();
latch1.countDown();
}
});
assertTrue(latch1.await(100, TimeUnit.MILLISECONDS));
final HandledObject o2 = recycler.get();
// Always recycler the first object, that is Ok
assertSame(o2, o);
final CountDownLatch latch2 = new CountDownLatch(1);
single.execute(new Runnable() {
@Override
public void run() {
//The object should be recycled
o2.recycle();
latch2.countDown();
}
});
assertTrue(latch2.await(100, TimeUnit.MILLISECONDS));
// It should be the same object, right?
final HandledObject o3 = recycler.get();
assertSame(o3, o);
single.shutdown();
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does testRecycleAtTwoThreadsMulti() do?
testRecycleAtTwoThreadsMulti() is a function in the netty codebase, defined in common/src/test/java/io/netty/util/RecyclerTest.java.
Where is testRecycleAtTwoThreadsMulti() defined?
testRecycleAtTwoThreadsMulti() is defined in common/src/test/java/io/netty/util/RecyclerTest.java at line 475.
What does testRecycleAtTwoThreadsMulti() call?
testRecycleAtTwoThreadsMulti() calls 2 function(s): newRecycler, recycle.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free