ProducerConsumerState Class — netty Architecture
Architecture documentation for the ProducerConsumerState class in RecyclerBenchmark.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3281c044_c5b7_e805_4b8f_caff2d5a3d60["ProducerConsumerState"] 7aaaabe7_71e7_6b45_0baa_7e060ebdcd2a["RecyclerBenchmark.java"] 3281c044_c5b7_e805_4b8f_caff2d5a3d60 -->|defined in| 7aaaabe7_71e7_6b45_0baa_7e060ebdcd2a d4c25e69_1126_b27f_a107_d7b49775f0ce["init()"] 3281c044_c5b7_e805_4b8f_caff2d5a3d60 -->|method| d4c25e69_1126_b27f_a107_d7b49775f0ce
Relationship Graph
Source Code
microbench/src/main/java/io/netty/microbench/util/RecyclerBenchmark.java lines 77–114
@State(Scope.Benchmark)
public static class ProducerConsumerState {
@Param({ "false", "true" })
boolean unguarded;
@Param({ "false", "true" })
boolean fastThreadLocal;
Queue<DummyObject> queue;
Recycler<DummyObject> recycler;
@Setup
public void init(BenchmarkParams params) {
if (params.getBenchmark().endsWith("roducerConsumer")) {
final int threads = params.getThreads();
if (threads != 2) {
throw new IllegalStateException("ProducerConsumerState only supports exactly 2 threads");
}
}
queue = PlatformDependent.hasUnsafe()?
new SpscArrayQueue<>(100) : new SpscAtomicArrayQueue<>(100);
recycler = !fastThreadLocal?
new Recycler<DummyObject>(Thread.currentThread(), unguarded) {
@Override
protected DummyObject newObject(Recycler.Handle<DummyObject> handle) {
return new DummyObject((EnhancedHandle<DummyObject>) handle);
}
} :
new Recycler<DummyObject>(unguarded) {
@Override
protected DummyObject newObject(Recycler.Handle<DummyObject> handle) {
return new DummyObject((EnhancedHandle<DummyObject>) handle);
}
};
}
}
Source
Frequently Asked Questions
What is the ProducerConsumerState class?
ProducerConsumerState is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/util/RecyclerBenchmark.java.
Where is ProducerConsumerState defined?
ProducerConsumerState is defined in microbench/src/main/java/io/netty/microbench/util/RecyclerBenchmark.java at line 77.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free