BurstCostExecutorsBenchmark Class — netty Architecture
Architecture documentation for the BurstCostExecutorsBenchmark class in BurstCostExecutorsBenchmark.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 1e2b3bde_093d_e848_9b56_b6d1ef72c773["BurstCostExecutorsBenchmark"] b13bc1c1_6503_8c67_bdc7_874bea111591["BurstCostExecutorsBenchmark.java"] 1e2b3bde_093d_e848_9b56_b6d1ef72c773 -->|defined in| b13bc1c1_6503_8c67_bdc7_874bea111591 30fce65c_e43b_4fc1_f613_eceff016b47f["setup()"] 1e2b3bde_093d_e848_9b56_b6d1ef72c773 -->|method| 30fce65c_e43b_4fc1_f613_eceff016b47f 6e74c2dd_a082_e375_1ee7_a99b3cc88b4f["tearDown()"] 1e2b3bde_093d_e848_9b56_b6d1ef72c773 -->|method| 6e74c2dd_a082_e375_1ee7_a99b3cc88b4f e2bcf578_9fe6_2bab_fe5d_e5bf915516dc["test1Producer()"] 1e2b3bde_093d_e848_9b56_b6d1ef72c773 -->|method| e2bcf578_9fe6_2bab_fe5d_e5bf915516dc e3feb857_8b31_02a8_697f_f71c8e796ee5["test2Producers()"] 1e2b3bde_093d_e848_9b56_b6d1ef72c773 -->|method| e3feb857_8b31_02a8_697f_f71c8e796ee5 0c587ec6_d735_da5a_dcec_8a51c459e5e7["test3Producers()"] 1e2b3bde_093d_e848_9b56_b6d1ef72c773 -->|method| 0c587ec6_d735_da5a_dcec_8a51c459e5e7 f613e735_da60_ce3e_dba8_b3a093d55921["executeBurst()"] 1e2b3bde_093d_e848_9b56_b6d1ef72c773 -->|method| f613e735_da60_ce3e_dba8_b3a093d55921
Relationship Graph
Source Code
microbench/src/main/java/io/netty/microbench/concurrent/BurstCostExecutorsBenchmark.java lines 51–331
@State(Scope.Benchmark)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public class BurstCostExecutorsBenchmark extends AbstractMicrobenchmark {
/**
* This executor is useful as the best burst latency performer because it won't go to sleep and won't be hit by the
* cost of being awaken on both offer/consumer side.
*/
private static final class SpinExecutorService implements ExecutorService {
private static final Runnable POISON_PILL = new Runnable() {
@Override
public void run() {
}
};
private final Queue<Runnable> tasks;
private final AtomicBoolean poisoned = new AtomicBoolean();
private final Thread executorThread;
SpinExecutorService(int maxTasks) {
tasks = PlatformDependent.newFixedMpscQueue(maxTasks);
executorThread = new Thread(new Runnable() {
@Override
public void run() {
final Queue<Runnable> tasks = SpinExecutorService.this.tasks;
Runnable task;
while ((task = tasks.poll()) != POISON_PILL) {
if (task != null) {
task.run();
}
}
}
});
executorThread.start();
}
@Override
public void shutdown() {
if (poisoned.compareAndSet(false, true)) {
while (!tasks.offer(POISON_PILL)) {
// Just try again
}
try {
executorThread.join();
} catch (InterruptedException e) {
//We're quite trusty :)
}
}
}
@Override
public List<Runnable> shutdownNow() {
throw new UnsupportedOperationException();
}
@Override
public boolean isShutdown() {
throw new UnsupportedOperationException();
}
@Override
public boolean isTerminated() {
throw new UnsupportedOperationException();
}
@Override
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
throw new UnsupportedOperationException();
}
@Override
public <T> Future<T> submit(Callable<T> task) {
throw new UnsupportedOperationException();
}
@Override
public <T> Future<T> submit(Runnable task, T result) {
throw new UnsupportedOperationException();
}
@Override
Source
Frequently Asked Questions
What is the BurstCostExecutorsBenchmark class?
BurstCostExecutorsBenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/concurrent/BurstCostExecutorsBenchmark.java.
Where is BurstCostExecutorsBenchmark defined?
BurstCostExecutorsBenchmark is defined in microbench/src/main/java/io/netty/microbench/concurrent/BurstCostExecutorsBenchmark.java at line 51.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free