Package io.netty.resolver.dns
Class DnsQueryIdSpace
- java.lang.Object
-
- io.netty.resolver.dns.DnsQueryIdSpace
-
final class DnsQueryIdSpace extends java.lang.Object
Special data-structure that will allow to retrieve the next query id to use, while still guarantee some sort of randomness. The query id will be between 0 (inclusive) and 65535 (inclusive) as defined by the RFC.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DnsQueryIdSpace.DnsQueryIdRange
Provides a query if from a range of possible ids.
-
Field Summary
Fields Modifier and Type Field Description private static int
BUCKET_DROP_THRESHOLD
private static int
BUCKET_SIZE
private static int
BUCKETS
private DnsQueryIdSpace.DnsQueryIdRange[]
idBuckets
private static int
MAX_ID
-
Constructor Summary
Constructors Constructor Description DnsQueryIdSpace()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) int
maxUsableIds()
Return the maximum number of ids that are supported.private static DnsQueryIdSpace.DnsQueryIdRange
newBucket(int idBucketsIdx)
(package private) int
nextId()
Returns the next ID to use for a query or-1
if there is none left to use.(package private) void
pushId(int id)
Push back the id, so it can be used again for the next query.(package private) int
usableIds()
Return how much more usable ids are left.
-
-
-
Field Detail
-
MAX_ID
private static final int MAX_ID
- See Also:
- Constant Field Values
-
BUCKETS
private static final int BUCKETS
- See Also:
- Constant Field Values
-
BUCKET_SIZE
private static final int BUCKET_SIZE
- See Also:
- Constant Field Values
-
BUCKET_DROP_THRESHOLD
private static final int BUCKET_DROP_THRESHOLD
- See Also:
- Constant Field Values
-
idBuckets
private final DnsQueryIdSpace.DnsQueryIdRange[] idBuckets
-
-
Method Detail
-
newBucket
private static DnsQueryIdSpace.DnsQueryIdRange newBucket(int idBucketsIdx)
-
nextId
int nextId()
Returns the next ID to use for a query or-1
if there is none left to use.- Returns:
- next id to use.
-
pushId
void pushId(int id)
Push back the id, so it can be used again for the next query.- Parameters:
id
- the id.
-
usableIds
int usableIds()
Return how much more usable ids are left.- Returns:
- the number of ids that are left for usage.
-
maxUsableIds
int maxUsableIds()
Return the maximum number of ids that are supported.- Returns:
- the maximum number of ids.
-
-