Home / Class/ Environment Class — netty Architecture

Environment Class — netty Architecture

Architecture documentation for the Environment class in IntObjectHashMapBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  82a35403_7c2b_d103_4c1a_9dc614e8bbba["Environment"]
  6db8a76f_31e4_5c67_7f35_99ab8043f7cc["IntObjectHashMapBenchmark.java"]
  82a35403_7c2b_d103_4c1a_9dc614e8bbba -->|defined in| 6db8a76f_31e4_5c67_7f35_99ab8043f7cc
  32f3085c_21da_1b3c_610e_6897273b9bd8["Environment()"]
  82a35403_7c2b_d103_4c1a_9dc614e8bbba -->|method| 32f3085c_21da_1b3c_610e_6897273b9bd8
  eed0dc1b_0678_4a39_ddbb_985520c3cf5e["put()"]
  82a35403_7c2b_d103_4c1a_9dc614e8bbba -->|method| eed0dc1b_0678_4a39_ddbb_985520c3cf5e
  87246fd8_e983_1c70_0004_582bd9721b46["lookup()"]
  82a35403_7c2b_d103_4c1a_9dc614e8bbba -->|method| 87246fd8_e983_1c70_0004_582bd9721b46
  7d36a56a_55f6_1eb0_7546_2f6682672729["remove()"]
  82a35403_7c2b_d103_4c1a_9dc614e8bbba -->|method| 7d36a56a_55f6_1eb0_7546_2f6682672729

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbenchmark/common/IntObjectHashMapBenchmark.java lines 91–123

    private abstract class Environment {
        final int[] keys;
        Environment() {
            keys = new int[size];
            switch(keyDistribution) {
                case HTTP2:
                    for (int index = 0, key = 3; index < size; ++index, key += 2) {
                        keys[index] = key;
                    }
                    break;
                case RANDOM: {
                    // Create a 'size' # of random integers.
                    Random r = new Random();
                    Set<Integer> keySet = new HashSet<Integer>();
                    while (keySet.size() < size) {
                        keySet.add(r.nextInt());
                    }

                    int index = 0;
                    for (Integer key : keySet) {
                        keys[index++] = key;
                    }
                    break;
                }
                default: {
                    throw new IllegalStateException("Unknown keyDistribution: " + keyDistribution);
                }
            }
        }
        abstract void put(Blackhole bh);
        abstract void lookup(Blackhole bh);
        abstract void remove(Blackhole bh);
    }

Frequently Asked Questions

What is the Environment class?
Environment is a class in the netty codebase, defined in microbench/src/main/java/io/netty/microbenchmark/common/IntObjectHashMapBenchmark.java.
Where is Environment defined?
Environment is defined in microbench/src/main/java/io/netty/microbenchmark/common/IntObjectHashMapBenchmark.java at line 91.

Analyze Your Own Codebase

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

Try Supermodel Free