1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 02:39:42 +02:00

Make resolver-dnsjava, -minidns initializer

and OSGi components.

There is really no need to treat them different then
resolver-javax. This also allows the removal of the DNSUtil.init() method.
This commit is contained in:
Florian Schmaus 2014-08-11 19:21:43 +02:00
parent a5eebf3840
commit 0c0737942c
10 changed files with 55 additions and 50 deletions

View file

@ -19,6 +19,8 @@ package org.jivesoftware.smack.util.dns.dnsjava;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.initializer.SmackAndOsgiInitializer;
import org.jivesoftware.smack.util.DNSUtil;
import org.jivesoftware.smack.util.dns.DNSResolver;
import org.jivesoftware.smack.util.dns.SRVRecord;
import org.xbill.DNS.Lookup;
@ -30,13 +32,10 @@ import org.xbill.DNS.Type;
* This implementation uses the <a href="http://www.dnsjava.org/">dnsjava</a> implementation for resolving DNS addresses.
*
*/
public class DNSJavaResolver implements DNSResolver {
public class DNSJavaResolver extends SmackAndOsgiInitializer implements DNSResolver {
private static DNSJavaResolver instance = new DNSJavaResolver();
private DNSJavaResolver() {
}
public static DNSResolver getInstance() {
return instance;
}
@ -65,4 +64,15 @@ public class DNSJavaResolver implements DNSResolver {
return res;
}
public static void setup() {
DNSUtil.setDNSResolver(getInstance());
}
@Override
public List<Exception> initialize() {
setup();
return null;
}
}