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:
parent
a5eebf3840
commit
0c0737942c
10 changed files with 55 additions and 50 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue