Home / Function/ nextId() — netty Function Reference

nextId() — netty Function Reference

Architecture documentation for the nextId() function in DnsQueryIdSpace.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  36354315_78f9_d7b6_6c63_9f282125f564["nextId()"]
  7fd57a0f_a8fa_aafd_24b0_9510d2efbadc["DnsQueryIdSpace"]
  36354315_78f9_d7b6_6c63_9f282125f564 -->|defined in| 7fd57a0f_a8fa_aafd_24b0_9510d2efbadc
  5b6bfad2_4909_65b8_2d5f_3f2351c9ec9a["nextId()"]
  5b6bfad2_4909_65b8_2d5f_3f2351c9ec9a -->|calls| 36354315_78f9_d7b6_6c63_9f282125f564
  5b6bfad2_4909_65b8_2d5f_3f2351c9ec9a["nextId()"]
  36354315_78f9_d7b6_6c63_9f282125f564 -->|calls| 5b6bfad2_4909_65b8_2d5f_3f2351c9ec9a
  style 36354315_78f9_d7b6_6c63_9f282125f564 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

resolver-dns/src/main/java/io/netty/resolver/dns/DnsQueryIdSpace.java lines 53–80

    int nextId() {
        int freeIdx = -1;
        for (int bucketIdx = 0; bucketIdx < idBuckets.length; bucketIdx++) {
            DnsQueryIdRange bucket = idBuckets[bucketIdx];
            if (bucket != null) {
                int id = bucket.nextId();
                if (id != -1) {
                    return id;
                }
            } else if (freeIdx == -1 ||
                    // Let's make it somehow random which free slot is used.
                    ThreadLocalRandom.current().nextBoolean()) {
                // We have a slot that we can use to create a new bucket if we need to.
                freeIdx = bucketIdx;
            }
        }
        if (freeIdx == -1) {
            // No ids left and no slot left to create a new bucket.
            return -1;
        }

        // We still have some slots free to store a new bucket. Let's do this now and use it to generate the next id.
        DnsQueryIdRange bucket = newBucket(freeIdx);
        idBuckets[freeIdx] = bucket;
        int id = bucket.nextId();
        assert id >= 0;
        return id;
    }

Subdomains

Calls

Called By

Frequently Asked Questions

What does nextId() do?
nextId() is a function in the netty codebase, defined in resolver-dns/src/main/java/io/netty/resolver/dns/DnsQueryIdSpace.java.
Where is nextId() defined?
nextId() is defined in resolver-dns/src/main/java/io/netty/resolver/dns/DnsQueryIdSpace.java at line 53.
What does nextId() call?
nextId() calls 1 function(s): nextId.
What calls nextId()?
nextId() is called by 1 function(s): nextId.

Analyze Your Own Codebase

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

Try Supermodel Free