List of usage examples for io.netty.resolver.dns DnsQueryContext question
DnsQuestion question
To view the source code for io.netty.resolver.dns DnsQueryContext question.
Click Source Link
From source file:io.vertx.core.dns.impl.fix.DnsQueryContextManager.java
License:Apache License
int add(DnsQueryContext qCtx) { final IntObjectMap<DnsQueryContext> contexts = getOrCreateContextMap(qCtx.nameServerAddr()); int id = ThreadLocalRandom.current().nextInt(1, 65536); final int maxTries = 65535 << 1; int tries = 0; synchronized (contexts) { for (;;) { if (!contexts.containsKey(id)) { contexts.put(id, qCtx);/*from w w w .java2 s . co m*/ return id; } id = id + 1 & 0xFFFF; if (++tries >= maxTries) { throw new IllegalStateException("query ID space exhausted: " + qCtx.question()); } } } }