boolean resultViaCache = false;
do {
// Ask dnsjava for the inetaddress. Should be in its cache.
Message response = null;
InetAddress address = null;
String cname = null;
long expireTime = -1;
Exception resolverException = null;
_queryCount++;
try {
// LOG.info("Checking Cache for Host:" + hostName);
if (!noCache)
result = checkCache(client, hostName);
if (result != null) {
// increment stats ...
_cacheHits++;
resultViaCache = true;
}
} catch (UnknownHostException e) {
if (_logger != null)
_logger.logDNSException(hostName, StringUtils.stringifyException(e));
}
// if not found in cache ... then do full lookup ...
if (result == null) {
_cacheMisses++;
try {
SimpleResolver resolver = new SimpleResolver(_dnsServerAddress);
// allocate a simple resolver object ...
//NIODNSSimpleResolverImpl resolver = new NIODNSSimpleResolverImpl(this, _dnsServerAddress);
// use tcp if requested ...
if (useTCP)
resolver.setTCP(true);
// set the timeout ...
resolver.setTimeout(timeoutValue);
// create appropriate data structures ...
Name name = Name.fromString(hostName, Name.root);
Record rec = Record.newRecord(name, Type.A, DClass.IN);
Message query = Message.newQuery(rec);
// send it off ...
try {
response = resolver.send(query);
} catch (IOException e) {