Home / Class/ GenericEventExecutorChooser Class — netty Architecture

GenericEventExecutorChooser Class — netty Architecture

Architecture documentation for the GenericEventExecutorChooser class in DefaultEventExecutorChooserFactory.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  43f6f473_b8c5_2ca4_bda4_f41c6d7cfe79["GenericEventExecutorChooser"]
  e9573f02_fa38_a523_6328_d0056df7c09f["DefaultEventExecutorChooserFactory.java"]
  43f6f473_b8c5_2ca4_bda4_f41c6d7cfe79 -->|defined in| e9573f02_fa38_a523_6328_d0056df7c09f
  5945fa27_04a5_12b9_dabe_e613d3ff9400["GenericEventExecutorChooser()"]
  43f6f473_b8c5_2ca4_bda4_f41c6d7cfe79 -->|method| 5945fa27_04a5_12b9_dabe_e613d3ff9400
  c8ea4ad2_c7b1_16f0_46ad_a88fbc0ec485["EventExecutor()"]
  43f6f473_b8c5_2ca4_bda4_f41c6d7cfe79 -->|method| c8ea4ad2_c7b1_16f0_46ad_a88fbc0ec485

Relationship Graph

Source Code

common/src/main/java/io/netty/util/concurrent/DefaultEventExecutorChooserFactory.java lines 57–72

    private static final class GenericEventExecutorChooser implements EventExecutorChooser {
        // Use a 'long' counter to avoid non-round-robin behaviour at the 32-bit overflow boundary.
        // The 64-bit long solves this by placing the overflow so far into the future, that no system
        // will encounter this in practice.
        private final AtomicLong idx = new AtomicLong();
        private final EventExecutor[] executors;

        GenericEventExecutorChooser(EventExecutor[] executors) {
            this.executors = executors;
        }

        @Override
        public EventExecutor next() {
            return executors[(int) Math.abs(idx.getAndIncrement() % executors.length)];
        }
    }

Frequently Asked Questions

What is the GenericEventExecutorChooser class?
GenericEventExecutorChooser is a class in the netty codebase, defined in common/src/main/java/io/netty/util/concurrent/DefaultEventExecutorChooserFactory.java.
Where is GenericEventExecutorChooser defined?
GenericEventExecutorChooser is defined in common/src/main/java/io/netty/util/concurrent/DefaultEventExecutorChooserFactory.java at line 57.

Analyze Your Own Codebase

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

Try Supermodel Free