Class DefaultIoClientFactory

java.lang.Object
org.xbill.DNS.io.DefaultIoClientFactory
All Implemented Interfaces:
IoClientFactory

public class DefaultIoClientFactory extends Object implements IoClientFactory
Serves as a default implementation that is used by the SimpleResolver, unless otherwise configured. This preserves the default behavior (to use the built-in NIO clients) while allowing flexibility at the point of use.
Since:
3.6
  • Field Details

    • RESOLVER_CLIENT

      private static final DefaultIoClient RESOLVER_CLIENT
      Shared instance because it only serves as a bridge to the static NIO classes and does not need to be different per class.
  • Constructor Details

    • DefaultIoClientFactory

      public DefaultIoClientFactory()
  • Method Details

    • createOrGetTcpClient

      public TcpIoClient createOrGetTcpClient()
      Description copied from interface: IoClientFactory
      Create or return a cached/reused instance of the TCP resolver that should be used to send DNS data over the wire to the remote target.
      It is the responsibility of this method to manage pooling or connection reuse. This method is called right before the connection is made every time the SimpleResolver is called. The implementer of this method should be aware and choose how to pool or reuse connections.
      Specified by:
      createOrGetTcpClient in interface IoClientFactory
      Returns:
      an instance of the tcp resolver client
    • createOrGetUdpClient

      public UdpIoClient createOrGetUdpClient()
      Description copied from interface: IoClientFactory
      Create or return a cached/reused instance of the UDP resolver that should be used to send DNS data over the wire to the remote target.
      Specified by:
      createOrGetUdpClient in interface IoClientFactory
      Returns:
      an instance of the udp resolver client