Home / Class/ AbstractSharedExecutorMicrobenchmark Class — netty Architecture

AbstractSharedExecutorMicrobenchmark Class — netty Architecture

Architecture documentation for the AbstractSharedExecutorMicrobenchmark class in AbstractSharedExecutorMicrobenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e8d0f38c_d120_c2c3_ac4c_f5a7174abfac["AbstractSharedExecutorMicrobenchmark"]
  f3161f47_05ac_b59c_e5de_4f1df8377ec9["AbstractSharedExecutorMicrobenchmark.java"]
  e8d0f38c_d120_c2c3_ac4c_f5a7174abfac -->|defined in| f3161f47_05ac_b59c_e5de_4f1df8377ec9
  134372c1_4b95_40e4_bf54_e422647780cf["executor()"]
  e8d0f38c_d120_c2c3_ac4c_f5a7174abfac -->|method| 134372c1_4b95_40e4_bf54_e422647780cf
  1f3529b4_591d_b843_9c8e_6bb50f2f502e["jvmArgs()"]
  e8d0f38c_d120_c2c3_ac4c_f5a7174abfac -->|method| 1f3529b4_591d_b843_9c8e_6bb50f2f502e
  aad5d4d8_27b2_7cc5_ad30_707f690873c2["handleUnexpectedException()"]
  e8d0f38c_d120_c2c3_ac4c_f5a7174abfac -->|method| aad5d4d8_27b2_7cc5_ad30_707f690873c2

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/util/AbstractSharedExecutorMicrobenchmark.java lines 34–160

@Fork(AbstractSharedExecutorMicrobenchmark.DEFAULT_FORKS)
public class AbstractSharedExecutorMicrobenchmark extends AbstractMicrobenchmarkBase {

    protected static final int DEFAULT_FORKS = 1;
    protected static final String[] JVM_ARGS;

    static {
        final String[] customArgs = {
        "-Xms2g", "-Xmx2g", "-XX:MaxDirectMemorySize=2g", "-Djmh.executor=CUSTOM",
        "-Djmh.executor.class=io.netty.microbench.util.AbstractSharedExecutorMicrobenchmark$DelegateHarnessExecutor" };

        JVM_ARGS = new String[BASE_JVM_ARGS.length + customArgs.length];
        System.arraycopy(BASE_JVM_ARGS, 0, JVM_ARGS, 0, BASE_JVM_ARGS.length);
        System.arraycopy(customArgs, 0, JVM_ARGS, BASE_JVM_ARGS.length, customArgs.length);
    }

    /**
     * Set the executor (in the form of an {@link EventLoop}) which JMH will use.
     * <p>
     * This must be called before JMH requires an executor to execute objects.
     * @param eventLoop Used as an executor by JMH to run benchmarks.
     */
    public static void executor(EventLoop eventLoop) {
        DelegateHarnessExecutor.executor(eventLoop);
    }

    /**
     * This executor allows Netty and JMH to share a common executor.
     * This is achieved by using {@link DelegateHarnessExecutor#executor(EventLoop)}
     * with the {@link EventLoop} used by Netty.
     */
    public static final class DelegateHarnessExecutor extends AbstractEventExecutor {
        private static EventLoop executor;
        private static final InternalLogger logger = InternalLoggerFactory.getInstance(DelegateHarnessExecutor.class);

        public DelegateHarnessExecutor(int maxThreads, String prefix) {
            logger.debug("Using DelegateHarnessExecutor executor {}", this);
        }

        /**
         * Set the executor (in the form of an {@link EventLoop}) which JMH will use.
         * <p>
         * This must be called before JMH requires an executor to execute objects.
         * @param service Used as an executor by JMH to run benchmarks.
         */
        public static void executor(EventLoop service) {
            executor = service;
        }

        @Override
        public boolean inEventLoop() {
            return executor.inEventLoop();
        }

        @Override
        public boolean inEventLoop(Thread thread) {
            return executor.inEventLoop(thread);
        }

        @Override
        public Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit) {
            return executor.shutdownGracefully(quietPeriod, timeout, unit);
        }

        @Override
        public Future<?> terminationFuture() {
            return executor.terminationFuture();
        }

        @Override
        @Deprecated
        public void shutdown() {
            executor.shutdown();
        }

        @Override
        public boolean isShuttingDown() {
            return executor.isShuttingDown();
        }

        @Override

Frequently Asked Questions

What is the AbstractSharedExecutorMicrobenchmark class?
AbstractSharedExecutorMicrobenchmark is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/util/AbstractSharedExecutorMicrobenchmark.java.
Where is AbstractSharedExecutorMicrobenchmark defined?
AbstractSharedExecutorMicrobenchmark is defined in microbench/src/main/java/io/netty/microbench/util/AbstractSharedExecutorMicrobenchmark.java at line 34.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free