run() — netty Function Reference
Architecture documentation for the run() function in AllocationPatternSimulator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 06934b47_b83d_1faa_16c1_8d69d2ca2fd8["run()"] 205b6069_4dbe_3fcd_334a_3a81de7610c1["Workload"] 06934b47_b83d_1faa_16c1_8d69d2ca2fd8 -->|defined in| 205b6069_4dbe_3fcd_334a_3a81de7610c1 76ec3af2_8878_9d60_39b7_18461aa6fefd["run()"] 76ec3af2_8878_9d60_39b7_18461aa6fefd -->|calls| 06934b47_b83d_1faa_16c1_8d69d2ca2fd8 76ec3af2_8878_9d60_39b7_18461aa6fefd["run()"] 06934b47_b83d_1faa_16c1_8d69d2ca2fd8 -->|calls| 76ec3af2_8878_9d60_39b7_18461aa6fefd 5ae69ead_3533_e39b_2f7e_2fd0c81649db["size()"] 06934b47_b83d_1faa_16c1_8d69d2ca2fd8 -->|calls| 5ae69ead_3533_e39b_2f7e_2fd0c81649db style 06934b47_b83d_1faa_16c1_8d69d2ca2fd8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
microbench/src/main/java/io/netty/buffer/AllocationPatternSimulator.java lines 631–661
@SuppressWarnings("BusyWait")
@Override
public void run() {
try {
startLatch.await();
List<ByteBuf> buffers = new ArrayList<>();
while (!stopCondition.get()) {
Thread.sleep(1);
int freqChoice = rng.nextInt(0, sumFrequency);
int choiceIndex = Arrays.binarySearch(cumulativeFrequency, freqChoice);
if (choiceIndex < 0) {
choiceIndex = -(choiceIndex + 1);
}
int chosenSize = size[choiceIndex];
ByteBuf buf = allocator.heapBuffer(chosenSize);
buffers.add(buf);
while (buffers.size() > rng.nextInt(0, avgLiveBuffers << 1)) {
int deallocChoice = rng.nextInt(0, buffers.size());
ByteBuf toDealloc = buffers.get(deallocChoice);
ByteBuf lastBuffer = buffers.remove(buffers.size() - 1);
if (toDealloc != lastBuffer) {
buffers.set(deallocChoice, lastBuffer);
}
toDealloc.release();
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does run() do?
run() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/buffer/AllocationPatternSimulator.java.
Where is run() defined?
run() is defined in microbench/src/main/java/io/netty/buffer/AllocationPatternSimulator.java at line 631.
What does run() call?
run() calls 2 function(s): run, size.
What calls run()?
run() is called by 1 function(s): run.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free