Class DnsQueryContext

    • Field Detail

      • ID_REUSE_ON_TIMEOUT_DELAY_MILLIS

        private static final long ID_REUSE_ON_TIMEOUT_DELAY_MILLIS
      • channelReadyFuture

        private final Future<? extends Channel> channelReadyFuture
      • channel

        private final Channel channel
      • nameServerAddr

        private final java.net.InetSocketAddress nameServerAddr
      • additionals

        private final DnsRecord[] additionals
      • optResource

        private final DnsRecord optResource
      • recursionDesired

        private final boolean recursionDesired
      • timeoutFuture

        private volatile Future<?> timeoutFuture
      • id

        private int id
    • Method Detail

      • hasOptRecord

        private static boolean hasOptRecord​(DnsRecord[] additionals)
      • isDone

        final boolean isDone()
        Returns true if the query was completed already.
        Returns:
        true if done.
      • newQuery

        protected abstract DnsQuery newQuery​(int id,
                                             java.net.InetSocketAddress nameServerAddr)
        Creates and returns a new DnsQuery.
        Parameters:
        id - the transaction id to use.
        nameServerAddr - the nameserver to which the query will be send.
        Returns:
        the new query.
      • protocol

        protected abstract java.lang.String protocol()
        Returns the protocol that is used for the query.
        Returns:
        the protocol.
      • writeQuery

        final ChannelFuture writeQuery​(long queryTimeoutMillis,
                                       boolean flush)
        Write the query and return the ChannelFuture that is completed once the write completes.
        Parameters:
        queryTimeoutMillis - the timeout after which the query is considered timeout and the original Promise will be failed.
        flush - true if Channel.flush() should be called as well.
        Returns:
        the ChannelFuture that is notified once once the write completes.
      • removeFromContextManager

        private void removeFromContextManager​(java.net.InetSocketAddress nameServerAddr)
      • sendQuery

        private ChannelFuture sendQuery​(java.net.InetSocketAddress nameServerAddr,
                                        DnsQuery query,
                                        long queryTimeoutMillis,
                                        boolean flush)
      • failQuery

        private void failQuery​(DnsQuery query,
                               java.lang.Throwable cause,
                               ChannelPromise writePromise)
      • writeQuery

        private void writeQuery​(java.net.InetSocketAddress nameServerAddr,
                                DnsQuery query,
                                long queryTimeoutMillis,
                                boolean flush,
                                ChannelPromise promise)
      • onQueryWriteCompletion

        private void onQueryWriteCompletion​(long queryTimeoutMillis,
                                            ChannelFuture writeFuture)
      • finishFailure

        final boolean finishFailure​(java.lang.String message,
                                    java.lang.Throwable cause,
                                    boolean timeout)
        Notifies the original Promise that the query completes because of an failure.