Package io.netty.resolver.dns
Class DnsQueryIdSpace
java.lang.Object
io.netty.resolver.dns.DnsQueryIdSpace
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 ClassesModifier and TypeClassDescriptionprivate static final classProvides a query if from a range of possible ids. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate final DnsQueryIdSpace.DnsQueryIdRange[]private static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) intReturn the maximum number of ids that are supported.private static DnsQueryIdSpace.DnsQueryIdRangenewBucket(int idBucketsIdx) (package private) intnextId()Returns the next ID to use for a query or-1if there is none left to use.(package private) voidpushId(int id) Push back the id, so it can be used again for the next query.(package private) intReturn how much more usable ids are left.
-
Field Details
-
MAX_ID
private static final int MAX_ID- See Also:
-
BUCKETS
private static final int BUCKETS- See Also:
-
BUCKET_SIZE
private static final int BUCKET_SIZE- See Also:
-
BUCKET_DROP_THRESHOLD
private static final int BUCKET_DROP_THRESHOLD- See Also:
-
idBuckets
-
-
Constructor Details
-
DnsQueryIdSpace
DnsQueryIdSpace()
-
-
Method Details
-
newBucket
-
nextId
int nextId()Returns the next ID to use for a query or-1if 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.
-