Package org.minidns.source
Class AbstractDnsDataSource
- java.lang.Object
-
- org.minidns.source.AbstractDnsDataSource
-
- All Implemented Interfaces:
DnsDataSource
- Direct Known Subclasses:
AsyncNetworkDataSource
,NetworkDataSource
public abstract class AbstractDnsDataSource extends Object implements DnsDataSource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractDnsDataSource.QueryMode
-
Nested classes/interfaces inherited from interface org.minidns.source.DnsDataSource
DnsDataSource.OnResponseCallback
-
-
Field Summary
Fields Modifier and Type Field Description protected int
timeout
DNS timeout.protected int
udpPayloadSize
-
Constructor Summary
Constructors Constructor Description AbstractDnsDataSource()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
cacheResult(DnsMessage request, DnsQueryResult response)
AbstractDnsDataSource.QueryMode
getQueryMode()
int
getTimeout()
Retrieve the current dns query timeout, in milliseconds.int
getUdpPayloadSize()
abstract DnsQueryResult
query(DnsMessage message, InetAddress address, int port)
MiniDnsFuture<DnsQueryResult,IOException>
queryAsync(DnsMessage message, InetAddress address, int port, DnsDataSource.OnResponseCallback onResponseCallback)
void
setQueryMode(AbstractDnsDataSource.QueryMode queryMode)
void
setTimeout(int timeout)
Change the dns query timeout for all future queries.void
setUdpPayloadSize(int udpPayloadSize)
-
-
-
Field Detail
-
udpPayloadSize
protected int udpPayloadSize
-
timeout
protected int timeout
DNS timeout.
-
-
Constructor Detail
-
AbstractDnsDataSource
public AbstractDnsDataSource()
-
-
Method Detail
-
query
public abstract DnsQueryResult query(DnsMessage message, InetAddress address, int port) throws IOException
- Specified by:
query
in interfaceDnsDataSource
- Throws:
IOException
-
queryAsync
public MiniDnsFuture<DnsQueryResult,IOException> queryAsync(DnsMessage message, InetAddress address, int port, DnsDataSource.OnResponseCallback onResponseCallback)
- Specified by:
queryAsync
in interfaceDnsDataSource
-
getTimeout
public int getTimeout()
Description copied from interface:DnsDataSource
Retrieve the current dns query timeout, in milliseconds.- Specified by:
getTimeout
in interfaceDnsDataSource
- Returns:
- the current dns query timeout in milliseconds.
-
setTimeout
public void setTimeout(int timeout)
Description copied from interface:DnsDataSource
Change the dns query timeout for all future queries. The timeout must be specified in milliseconds.- Specified by:
setTimeout
in interfaceDnsDataSource
- Parameters:
timeout
- new dns query timeout in milliseconds.
-
getUdpPayloadSize
public int getUdpPayloadSize()
- Specified by:
getUdpPayloadSize
in interfaceDnsDataSource
-
setUdpPayloadSize
public void setUdpPayloadSize(int udpPayloadSize)
-
cacheResult
protected final void cacheResult(DnsMessage request, DnsQueryResult response)
-
setQueryMode
public void setQueryMode(AbstractDnsDataSource.QueryMode queryMode)
-
getQueryMode
public AbstractDnsDataSource.QueryMode getQueryMode()
-
-