Perfume Of Love v2.14.9版本的 MD5 值为:16011aefc5a55805771706ce3b259b4e
以下内容为反编译后的 DiDns.java 源代码,内容仅作参考
package com.smaato.sdk.core.dns;
import com.smaato.sdk.core.di.ClassFactory;
import com.smaato.sdk.core.di.DiConstructor;
import com.smaato.sdk.core.di.DiRegistry;
import com.smaato.sdk.core.dns.DiDns;
import com.smaato.sdk.core.util.collections.Sets;
import com.smaato.sdk.core.util.fi.Consumer;
import com.smaato.sdk.core.util.fi.Supplier;
import java.net.InetAddress;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
public final class DiDns {
private static final Set<InetAddress> DNS_SERVERS = Sets.of(InetAddressUtil.ipv4From("8.8.8.8"), InetAddressUtil.ipv6From("[2001:4860:4860::8888]"));
private DiDns() {
}
public static DiRegistry createRegistry() {
return DiRegistry.of(new Consumer() {
@Override
public final void accept(Object obj) {
DiDns.lambda$createRegistry$4((DiRegistry) obj);
}
});
}
public static void lambda$createRegistry$4(DiRegistry diRegistry) {
diRegistry.registerFactory(DnsResolver.class, new ClassFactory() {
@Override
public final Object get(DiConstructor diConstructor) {
return DiDns.lambda$createRegistry$0(diConstructor);
}
});
diRegistry.registerFactory(DnsClient.class, new ClassFactory() {
@Override
public final Object get(DiConstructor diConstructor) {
return DiDns.lambda$createRegistry$2(diConstructor);
}
});
diRegistry.registerFactory(DnsDataSource.class, new ClassFactory() {
@Override
public final Object get(DiConstructor diConstructor) {
return DiDns.lambda$createRegistry$3(diConstructor);
}
});
}
public static DnsResolver lambda$createRegistry$0(DiConstructor diConstructor) {
return new DnsResolver((DnsClient) diConstructor.get(DnsClient.class));
}
public static DnsClient lambda$createRegistry$2(DiConstructor diConstructor) {
return new DnsClient((DnsDataSource) diConstructor.get(DnsDataSource.class), new Supplier() {
@Override
public final Object get() {
Integer valueOf;
valueOf = Integer.valueOf(DiDns.IdGenerator.access$000());
return valueOf;
}
}, DNS_SERVERS);
}
public static DnsDataSource lambda$createRegistry$3(DiConstructor diConstructor) {
return new DnsDataSource();
}
public static class IdGenerator {
private static final AtomicInteger nextGeneratedId = new AtomicInteger(1);
private IdGenerator() {
}
static int access$000() {
return generateViewId();
}
private static int generateViewId() {
AtomicInteger atomicInteger;
int i;
int i2;
do {
atomicInteger = nextGeneratedId;
i = atomicInteger.get();
i2 = i + 1;
if (i2 > 16777215) {
i2 = 1;
}
} while (!atomicInteger.compareAndSet(i, i2));
return i;
}
}
}