mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 14:02:06 +01:00
Add log to DNSUtil
This commit is contained in:
parent
fa71ff9605
commit
8321948b3c
1 changed files with 9 additions and 0 deletions
|
@ -22,6 +22,8 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.SortedMap;
|
import java.util.SortedMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.jivesoftware.smack.util.dns.DNSResolver;
|
import org.jivesoftware.smack.util.dns.DNSResolver;
|
||||||
import org.jivesoftware.smack.util.dns.HostAddress;
|
import org.jivesoftware.smack.util.dns.HostAddress;
|
||||||
|
@ -34,6 +36,7 @@ import org.jivesoftware.smack.util.dns.SRVRecord;
|
||||||
*/
|
*/
|
||||||
public class DNSUtil {
|
public class DNSUtil {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = Logger.getLogger(DNSUtil.class.getName());
|
||||||
private static DNSResolver dnsResolver = null;
|
private static DNSResolver dnsResolver = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,6 +124,12 @@ public class DNSUtil {
|
||||||
srvDomain = domain;
|
srvDomain = domain;
|
||||||
}
|
}
|
||||||
List<SRVRecord> srvRecords = dnsResolver.lookupSRVRecords(srvDomain);
|
List<SRVRecord> srvRecords = dnsResolver.lookupSRVRecords(srvDomain);
|
||||||
|
if (LOGGER.isLoggable(Level.FINE)) {
|
||||||
|
String logMessage = "Resolved SRV RR for " + srvDomain + ":";
|
||||||
|
for (SRVRecord r : srvRecords)
|
||||||
|
logMessage += " " + r;
|
||||||
|
LOGGER.fine(logMessage);
|
||||||
|
}
|
||||||
List<HostAddress> sortedRecords = sortSRVRecords(srvRecords);
|
List<HostAddress> sortedRecords = sortSRVRecords(srvRecords);
|
||||||
addresses.addAll(sortedRecords);
|
addresses.addAll(sortedRecords);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue