正在查看: Hyouka private v5.8.9 应用的 l.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hyouka private v5.8.9 应用的 l.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package ya;
import java.io.IOException;
import java.io.Serializable;
import java.net.DatagramPacket;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.MulticastSocket;
import java.net.SocketException;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
import xa.a;
import xa.d;
import ya.h;
import ya.j;
import ya.m;
public class l extends xa.a implements ya.i, ya.j {
private static Logger E = Logger.getLogger(l.class.getName());
private static final Random F = new Random();
private volatile InetAddress a;
private volatile MulticastSocket b;
private final List<ya.d> c;
private final ConcurrentMap<String, List<m.a>> d;
private final Set<m.b> e;
private final ya.a f;
private final ConcurrentMap<String, xa.d> g;
private final ConcurrentMap<String, j> h;
protected Thread i;
private k j;
private Thread k;
private int l;
private long m;
private ya.c w;
private final ConcurrentMap<String, i> x;
private final String y;
private final ExecutorService p = Executors.newSingleThreadExecutor();
private final ReentrantLock r = new ReentrantLock();
private final Object B = new Object();
class a implements Runnable {
final m.a a;
final xa.c b;
a(m.a aVar, xa.c cVar) {
this.a = aVar;
this.b = cVar;
}
@Override
public void run() {
this.a.f(this.b);
}
}
class b implements Runnable {
final m.b a;
final xa.c b;
b(m.b bVar, xa.c cVar) {
this.a = bVar;
this.b = cVar;
}
@Override
public void run() {
this.a.c(this.b);
}
}
class c implements Runnable {
final m.b a;
final xa.c b;
c(m.b bVar, xa.c cVar) {
this.a = bVar;
this.b = cVar;
}
@Override
public void run() {
this.a.d(this.b);
}
}
class d implements Runnable {
final m.a a;
final xa.c b;
d(m.a aVar, xa.c cVar) {
this.a = aVar;
this.b = cVar;
}
@Override
public void run() {
this.a.d(this.b);
}
}
class e implements Runnable {
final m.a a;
final xa.c b;
e(m.a aVar, xa.c cVar) {
this.a = aVar;
this.b = cVar;
}
@Override
public void run() {
this.a.e(this.b);
}
}
class f extends Thread {
f(String str) {
super(str);
}
@Override
public void run() {
l.this.C();
}
}
static class g {
static final int[] a;
static {
int[] iArr = new int[h.values().length];
a = iArr;
try {
iArr[h.Add.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[h.Remove.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
public enum h {
Remove,
Update,
Add,
RegisterServiceType,
Noop
}
private static class i implements xa.e {
private final String c;
private final ConcurrentMap<String, xa.d> a = new ConcurrentHashMap();
private final ConcurrentMap<String, xa.c> b = new ConcurrentHashMap();
private volatile boolean d = true;
public i(String str) {
this.c = str;
}
@Override
public void b(xa.c cVar) {
synchronized (this) {
this.a.put(cVar.e(), cVar.c());
this.b.remove(cVar.e());
}
}
@Override
public void g(xa.c cVar) {
synchronized (this) {
this.a.remove(cVar.e());
this.b.remove(cVar.e());
}
}
@Override
public void h(xa.c cVar) {
synchronized (this) {
xa.d c = cVar.c();
if (c == null || !c.B()) {
p V0 = ((l) cVar.b()).V0(cVar.f(), cVar.e(), c != null ? c.x() : "", true);
if (V0 != null) {
this.a.put(cVar.e(), V0);
} else {
this.b.put(cVar.e(), cVar);
}
} else {
this.a.put(cVar.e(), c);
}
}
}
public String toString() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("\n\tType: ");
stringBuffer.append(this.c);
if (this.a.isEmpty()) {
stringBuffer.append("\n\tNo services collected.");
} else {
stringBuffer.append("\n\tServices");
for (String str : this.a.keySet()) {
stringBuffer.append("\n\t\tService: ");
stringBuffer.append(str);
stringBuffer.append(": ");
stringBuffer.append(this.a.get(str));
}
}
if (this.b.isEmpty()) {
stringBuffer.append("\n\tNo event queued.");
} else {
stringBuffer.append("\n\tEvents");
for (String str2 : this.b.keySet()) {
stringBuffer.append("\n\t\tEvent: ");
stringBuffer.append(str2);
stringBuffer.append(": ");
stringBuffer.append(this.b.get(str2));
}
}
return stringBuffer.toString();
}
}
public l(InetAddress inetAddress, String str) throws IOException {
if (E.isLoggable(Level.FINER)) {
E.finer("JmDNS instance created");
}
this.f = new ya.a(100);
this.c = Collections.synchronizedList(new ArrayList());
this.d = new ConcurrentHashMap();
this.e = Collections.synchronizedSet(new HashSet());
this.x = new ConcurrentHashMap();
this.g = new ConcurrentHashMap(20);
this.h = new ConcurrentHashMap(20);
k A = k.A(inetAddress, this, str);
this.j = A;
this.y = str == null ? A.q() : str;
N0(p0());
b1(w0().values());
h();
}
private void I(String str, xa.e eVar, boolean z) {
m.a aVar = new m.a(eVar, z);
String lowerCase = str.toLowerCase();
List<m.a> list = this.d.get(lowerCase);
if (list == null) {
if (this.d.putIfAbsent(lowerCase, new LinkedList()) == null && this.x.putIfAbsent(lowerCase, new i(str)) == null) {
I(lowerCase, this.x.get(lowerCase), true);
}
list = this.d.get(lowerCase);
}
if (list != null) {
synchronized (list) {
if (!list.contains(eVar)) {
list.add(aVar);
}
}
}
ArrayList arrayList = new ArrayList();
Iterator<ya.b> it = b0().c().iterator();
while (it.hasNext()) {
ya.h hVar = (ya.h) it.next();
if (hVar.f() == za.e.TYPE_SRV && hVar.b().endsWith(lowerCase)) {
arrayList.add(new o(this, hVar.h(), c1(hVar.h(), hVar.c()), hVar.A()));
}
}
Iterator it2 = arrayList.iterator();
while (it2.hasNext()) {
aVar.d((xa.c) it2.next());
}
d(str);
}
private boolean M0(p pVar) {
boolean z;
xa.d dVar;
String n = pVar.n();
long currentTimeMillis = System.currentTimeMillis();
do {
for (ya.b bVar : b0().g(pVar.n())) {
if (za.e.TYPE_SRV.equals(bVar.f()) && !bVar.j(currentTimeMillis)) {
h.f fVar = (h.f) bVar;
if (fVar.P() != pVar.p() || !fVar.R().equals(this.j.q())) {
if (E.isLoggable(Level.FINER)) {
E.finer("makeServiceNameUnique() JmDNS.makeServiceNameUnique srv collision:" + bVar + " s.server=" + fVar.R() + " " + this.j.q() + " equals:" + fVar.R().equals(this.j.q()));
}
pVar.g0(D0(pVar.o()));
z = true;
dVar = this.g.get(pVar.n());
if (dVar != null && dVar != pVar) {
pVar.g0(D0(pVar.o()));
z = true;
}
}
}
}
z = false;
dVar = this.g.get(pVar.n());
if (dVar != null) {
pVar.g0(D0(pVar.o()));
z = true;
}
} while (z);
return !n.equals(pVar.n());
}
private void N0(k kVar) throws IOException {
if (this.a == null) {
if (kVar.o() instanceof Inet6Address) {
this.a = InetAddress.getByName("FF02::FB");
} else {
this.a = InetAddress.getByName("224.0.0.251");
}
}
if (this.b != null) {
T();
}
this.b = new MulticastSocket(za.a.a);
if (kVar != null && kVar.p() != null) {
try {
this.b.setNetworkInterface(kVar.p());
} catch (SocketException e2) {
if (E.isLoggable(Level.FINE)) {
E.fine("openMulticastSocket() Set network interface exception: " + e2.getMessage());
}
}
}
this.b.setTimeToLive(255);
this.b.joinGroup(this.a);
}
private void T() {
if (E.isLoggable(Level.FINER)) {
E.finer("closeMulticastSocket()");
}
if (this.b != null) {
try {
try {
this.b.leaveGroup(this.a);
} catch (Exception e2) {
E.log(Level.WARNING, "closeMulticastSocket() Close socket exception ", (Throwable) e2);
}
} catch (SocketException unused) {
}
this.b.close();
while (true) {
Thread thread = this.k;
if (thread == null || !thread.isAlive()) {
break;
}
synchronized (this) {
try {
Thread thread2 = this.k;
if (thread2 != null && thread2.isAlive()) {
if (E.isLoggable(Level.FINER)) {
E.finer("closeMulticastSocket(): waiting for jmDNS monitor");
}
wait(1000L);
}
} catch (InterruptedException unused2) {
}
}
}
this.k = null;
this.b = null;
}
}
private void V() {
if (E.isLoggable(Level.FINER)) {
E.finer("disposeServiceCollectors()");
}
for (String str : this.x.keySet()) {
i iVar = this.x.get(str);
if (iVar != null) {
w(str, iVar);
this.x.remove(str, iVar);
}
}
}
private void b1(Collection<? extends xa.d> collection) {
if (this.k == null) {
q qVar = new q(this);
this.k = qVar;
qVar.start();
}
j();
Iterator<? extends xa.d> it = collection.iterator();
while (it.hasNext()) {
try {
u(new p(it.next()));
} catch (Exception e2) {
E.log(Level.WARNING, "start() Registration exception ", (Throwable) e2);
}
}
}
static String c1(String str, String str2) {
String lowerCase = str.toLowerCase();
String lowerCase2 = str2.toLowerCase();
return (!lowerCase2.endsWith(lowerCase) || lowerCase2.equals(lowerCase)) ? str2 : str2.substring(0, (str2.length() - str.length()) - 1);
}
private void h1(xa.d dVar, long j2) {
synchronized (dVar) {
long j3 = j2 / 200;
if (j3 < 1) {
j3 = 1;
}
for (int i2 = 0; i2 < j3 && !dVar.B(); i2++) {
try {
dVar.wait(200L);
} catch (InterruptedException unused) {
}
}
}
}
public static Random s0() {
return F;
}
void A0(ya.h hVar, long j2) {
h hVar2 = h.Noop;
boolean j3 = hVar.j(j2);
Logger logger = E;
Level level = Level.FINE;
if (logger.isLoggable(level)) {
E.fine(getName() + " handle response: " + hVar);
}
if (!hVar.o() && !hVar.i()) {
boolean p = hVar.p();
ya.h hVar3 = (ya.h) b0().f(hVar);
if (E.isLoggable(level)) {
E.fine(getName() + " handle response cached record: " + hVar3);
}
if (p) {
for (ya.b bVar : b0().g(hVar.b())) {
if (hVar.f().equals(bVar.f()) && hVar.e().equals(bVar.e()) && bVar != hVar3) {
((ya.h) bVar).L(j2);
}
}
}
if (hVar3 != null) {
if (j3) {
if (hVar.C() == 0) {
hVar2 = h.Noop;
hVar3.L(j2);
} else {
hVar2 = h.Remove;
b0().k(hVar3);
}
} else if (hVar.J(hVar3) && (hVar.s(hVar3) || hVar.g().length() <= 0)) {
hVar3.H(hVar);
hVar = hVar3;
} else if (hVar.F()) {
hVar2 = h.Update;
b0().l(hVar, hVar3);
} else {
hVar2 = h.Add;
b0().b(hVar);
}
} else if (!j3) {
hVar2 = h.Add;
b0().b(hVar);
}
}
if (hVar.f() == za.e.TYPE_PTR) {
if (hVar.o()) {
if (j3) {
return;
}
Q0(((h.e) hVar).P());
return;
} else if ((Q0(hVar.c()) | false) && hVar2 == h.Noop) {
hVar2 = h.RegisterServiceType;
}
}
if (hVar2 != h.Noop) {
e1(j2, hVar, hVar2);
}
}
@Override
public void B(xa.d dVar) {
p pVar = (p) this.g.get(dVar.n());
if (pVar == null) {
E.warning("Removing unregistered service info: " + dVar.n());
return;
}
pVar.J();
g();
pVar.l0(5000L);
this.g.remove(pVar.n(), pVar);
if (E.isLoggable(Level.FINE)) {
E.fine("unregisterService() JmDNS unregistered service as " + pVar);
}
}
void B0(ya.c cVar) throws IOException {
long currentTimeMillis = System.currentTimeMillis();
boolean z = false;
boolean z2 = false;
for (ya.h hVar : cVar.b()) {
A0(hVar, currentTimeMillis);
if (za.e.TYPE_A.equals(hVar.f()) || za.e.TYPE_AAAA.equals(hVar.f())) {
z |= hVar.E(this);
} else {
z2 |= hVar.E(this);
}
}
if (z || z2) {
j();
}
}
void C() {
Logger logger = E;
Level level = Level.FINER;
if (logger.isLoggable(level)) {
E.finer(getName() + "recover() Cleanning up");
}
E.warning("RECOVERING");
a();
ArrayList arrayList = new ArrayList(w0().values());
d1();
V();
g1(5000L);
p();
T();
b0().clear();
if (E.isLoggable(level)) {
E.finer(getName() + "recover() All is clean");
}
if (!I0()) {
E.log(Level.WARNING, getName() + "recover() Could not recover we are Down!");
c0();
return;
}
Iterator<? extends xa.d> it = arrayList.iterator();
while (it.hasNext()) {
((p) it.next()).a0();
}
P0();
try {
N0(p0());
b1(arrayList);
} catch (Exception e2) {
E.log(Level.WARNING, getName() + "recover() Start services exception ", (Throwable) e2);
}
E.log(Level.WARNING, getName() + "recover() We are back!");
}
void C0(xa.c cVar) {
ArrayList arrayList;
List<m.a> list = this.d.get(cVar.f().toLowerCase());
if (list == null || list.isEmpty() || cVar.c() == null || !cVar.c().B()) {
return;
}
synchronized (list) {
arrayList = new ArrayList(list);
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
this.p.submit(new a((m.a) it.next(), cVar));
}
}
String D0(String str) {
try {
int lastIndexOf = str.lastIndexOf(40);
int lastIndexOf2 = str.lastIndexOf(41);
if (lastIndexOf < 0 || lastIndexOf >= lastIndexOf2) {
str = str + " (2)";
} else {
str = str.substring(0, lastIndexOf) + "(" + (Integer.parseInt(str.substring(lastIndexOf + 1, lastIndexOf2)) + 1) + ")";
}
return str;
} catch (NumberFormatException unused) {
return str + " (2)";
}
}
public void E(ya.d dVar, ya.g gVar) {
long currentTimeMillis = System.currentTimeMillis();
this.c.add(dVar);
if (gVar != null) {
for (ya.b bVar : b0().g(gVar.c().toLowerCase())) {
if (gVar.y(bVar) && !bVar.j(currentTimeMillis)) {
dVar.a(b0(), currentTimeMillis, bVar);
}
}
}
}
public void E0() {
this.r.lock();
}
public void F0() {
this.r.unlock();
}
public boolean G0() {
return this.j.s();
}
public boolean H0(ab.a aVar, za.g gVar) {
return this.j.t(aVar, gVar);
}
public boolean I0() {
return this.j.u();
}
public boolean J0() {
return this.j.v();
}
public void K(ab.a aVar, za.g gVar) {
this.j.b(aVar, gVar);
}
public boolean K0() {
return this.j.x();
}
public boolean L0() {
return this.j.y();
}
public void O0() {
E.finer(getName() + "recover()");
if (K0() || isClosed() || J0() || I0()) {
return;
}
synchronized (this.B) {
if (P()) {
E.finer(getName() + "recover() thread " + Thread.currentThread().getName());
StringBuilder sb2 = new StringBuilder();
sb2.append(getName());
sb2.append(".recover()");
new f(sb2.toString()).start();
}
}
}
public boolean P() {
return this.j.c();
}
public boolean P0() {
return this.j.B();
}
public void Q() {
long currentTimeMillis = System.currentTimeMillis();
for (ya.b bVar : b0().c()) {
try {
ya.h hVar = (ya.h) bVar;
if (hVar.j(currentTimeMillis)) {
e1(currentTimeMillis, hVar, h.Remove);
b0().k(hVar);
} else if (hVar.G(currentTimeMillis)) {
T0(hVar);
}
} catch (Exception e2) {
E.log(Level.SEVERE, getName() + ".Error while reaping records: " + bVar, (Throwable) e2);
E.severe(toString());
}
}
}
public boolean Q0(String str) {
boolean z;
j jVar;
Map<d.a, String> N = p.N(str);
String str2 = N.get(d.a.Domain);
String str3 = N.get(d.a.Protocol);
String str4 = N.get(d.a.Application);
String str5 = N.get(d.a.Subtype);
StringBuilder sb2 = new StringBuilder();
sb2.append(str4.length() > 0 ? io.fabric.sdk.android.services.events.b.ROLL_OVER_FILE_NAME_SEPARATOR + str4 + "." : "");
sb2.append(str3.length() > 0 ? io.fabric.sdk.android.services.events.b.ROLL_OVER_FILE_NAME_SEPARATOR + str3 + "." : "");
sb2.append(str2);
sb2.append(".");
String sb3 = sb2.toString();
String lowerCase = sb3.toLowerCase();
if (E.isLoggable(Level.FINE)) {
Logger logger = E;
StringBuilder sb4 = new StringBuilder();
sb4.append(getName());
sb4.append(".registering service type: ");
sb4.append(str);
sb4.append(" as: ");
sb4.append(sb3);
sb4.append(str5.length() > 0 ? " subtype: " + str5 : "");
logger.fine(sb4.toString());
}
boolean z2 = true;
if (this.h.containsKey(lowerCase) || str4.toLowerCase().equals("dns-sd") || str2.toLowerCase().endsWith("in-addr.arpa") || str2.toLowerCase().endsWith("ip6.arpa")) {
z = false;
} else {
z = this.h.putIfAbsent(lowerCase, new j(sb3)) == null;
if (z) {
Set<m.b> set = this.e;
m.b[] bVarArr = (m.b[]) set.toArray(new m.b[set.size()]);
o oVar = new o(this, sb3, "", null);
for (m.b bVar : bVarArr) {
this.p.submit(new b(bVar, oVar));
}
}
}
if (str5.length() <= 0 || (jVar = this.h.get(lowerCase)) == null || jVar.c(str5)) {
return z;
}
synchronized (jVar) {
if (jVar.c(str5)) {
z2 = z;
} else {
jVar.a(str5);
Set<m.b> set2 = this.e;
m.b[] bVarArr2 = (m.b[]) set2.toArray(new m.b[set2.size()]);
o oVar2 = new o(this, io.fabric.sdk.android.services.events.b.ROLL_OVER_FILE_NAME_SEPARATOR + str5 + "._sub." + sb3, "", null);
for (m.b bVar2 : bVarArr2) {
this.p.submit(new c(bVar2, oVar2));
}
}
}
return z2;
}
public void R0(ab.a aVar) {
this.j.C(aVar);
}
public void S0(ya.d dVar) {
this.c.remove(dVar);
}
public void T0(ya.h hVar) {
xa.d A = hVar.A();
if (this.x.containsKey(A.z().toLowerCase())) {
d(A.z());
}
}
public boolean U() {
return this.j.d();
}
public void U0(String str, String str2, boolean z, long j2) {
h1(V0(str, str2, "", z), j2);
}
p V0(String str, String str2, String str3, boolean z) {
Q();
String lowerCase = str.toLowerCase();
Q0(str);
if (this.x.putIfAbsent(lowerCase, new i(str)) == null) {
I(lowerCase, this.x.get(lowerCase), true);
}
p u0 = u0(str, str2, str3, z);
b(u0);
return u0;
}
public void W0(ya.c cVar) {
E0();
try {
if (this.w == cVar) {
this.w = null;
}
} finally {
F0();
}
}
public boolean X0() {
return this.j.D();
}
public void Y0(ya.f fVar) throws IOException {
if (fVar.l()) {
return;
}
byte[] y = fVar.y();
DatagramPacket datagramPacket = new DatagramPacket(y, y.length, this.a, za.a.a);
Logger logger = E;
Level level = Level.FINEST;
if (logger.isLoggable(level)) {
try {
ya.c cVar = new ya.c(datagramPacket);
if (E.isLoggable(level)) {
E.finest("send(" + getName() + ") JmDNS out:" + cVar.y(true));
}
} catch (IOException e2) {
E.throwing(getClass().toString(), "send(" + getName() + ") - JmDNS can not parse what it sends!!!", e2);
}
}
MulticastSocket multicastSocket = this.b;
if (multicastSocket == null || multicastSocket.isClosed()) {
return;
}
multicastSocket.send(datagramPacket);
}
public void Z0(long j2) {
this.m = j2;
}
@Override
public void a() {
j.b.a().b(d0()).a();
}
public void a1(int i2) {
this.l = i2;
}
@Override
public void b(p pVar) {
j.b.a().b(d0()).b(pVar);
}
public ya.a b0() {
return this.f;
}
@Override
public void c() {
j.b.a().b(d0()).c();
}
public a.InterfaceC0042a c0() {
return null;
}
@Override
public void close() {
if (K0()) {
return;
}
Logger logger = E;
Level level = Level.FINER;
if (logger.isLoggable(level)) {
E.finer("Cancelling JmDNS: " + this);
}
if (U()) {
E.finer("Canceling the timer");
f();
d1();
V();
if (E.isLoggable(level)) {
E.finer("Wait for JmDNS cancel: " + this);
}
g1(5000L);
E.finer("Canceling the state timer");
c();
this.p.shutdown();
T();
if (this.i != null) {
Runtime.getRuntime().removeShutdownHook(this.i);
}
if (E.isLoggable(level)) {
E.finer("JmDNS closed.");
}
}
m(null);
}
@Override
public void d(String str) {
j.b.a().b(d0()).d(str);
}
public void d1() {
if (E.isLoggable(Level.FINER)) {
E.finer("unregisterAllServices()");
}
Iterator<String> it = this.g.keySet().iterator();
while (it.hasNext()) {
p pVar = (p) this.g.get(it.next());
if (pVar != null) {
if (E.isLoggable(Level.FINER)) {
E.finer("Cancelling service info: " + pVar);
}
pVar.J();
}
}
g();
for (String str : this.g.keySet()) {
p pVar2 = (p) this.g.get(str);
if (pVar2 != null) {
if (E.isLoggable(Level.FINER)) {
E.finer("Wait for service info cancel: " + pVar2);
}
pVar2.l0(5000L);
this.g.remove(str, pVar2);
}
}
}
public InetAddress e0() {
return this.a;
}
public void e1(long j2, ya.h hVar, h hVar2) {
ArrayList arrayList;
List<m.a> emptyList;
synchronized (this.c) {
arrayList = new ArrayList(this.c);
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
((ya.d) it.next()).a(b0(), j2, hVar);
}
if (za.e.TYPE_PTR.equals(hVar.f())) {
xa.c z = hVar.z(this);
if (z.c() == null || !z.c().B()) {
p u0 = u0(z.f(), z.e(), "", false);
if (u0.B()) {
z = new o(this, z.f(), z.e(), u0);
}
}
List<m.a> list = this.d.get(z.f().toLowerCase());
if (list != null) {
synchronized (list) {
emptyList = new ArrayList(list);
}
} else {
emptyList = Collections.emptyList();
}
if (E.isLoggable(Level.FINEST)) {
E.finest(getName() + ".updating record for event: " + z + " list " + emptyList + " operation: " + hVar2);
}
if (emptyList.isEmpty()) {
return;
}
int i2 = g.a[hVar2.ordinal()];
if (i2 == 1) {
for (m.a aVar : emptyList) {
if (aVar.b()) {
aVar.d(z);
} else {
this.p.submit(new d(aVar, z));
}
}
return;
}
if (i2 != 2) {
return;
}
for (m.a aVar2 : emptyList) {
if (aVar2.b()) {
aVar2.e(z);
} else {
this.p.submit(new e(aVar2, z));
}
}
}
}
@Override
public void f() {
j.b.a().b(d0()).f();
}
public boolean f1(long j2) {
return this.j.F(j2);
}
@Override
public void g() {
j.b.a().b(d0()).g();
}
public boolean g1(long j2) {
return this.j.G(j2);
}
public String getName() {
return this.y;
}
@Override
public void h() {
j.b.a().b(d0()).h();
}
@Override
public void i(ya.c cVar, int i2) {
j.b.a().b(d0()).i(cVar, i2);
}
public InetAddress i0() throws IOException {
return this.b.getInterface();
}
public boolean isClosed() {
return this.j.w();
}
@Override
public void j() {
j.b.a().b(d0()).j();
}
public long k0() {
return this.m;
}
@Override
public void l() {
j.b.a().b(d0()).l();
}
@Override
public boolean m(ab.a aVar) {
return this.j.m(aVar);
}
@Override
public void p() {
j.b.a().b(d0()).p();
}
public k p0() {
return this.j;
}
@Override
public void q() {
j.b.a().b(d0()).q();
}
@Override
public void r(String str, xa.e eVar) {
I(str, eVar, false);
}
@Override
public xa.d t(String str, String str2) {
return t0(str, str2, false, 6000L);
}
public xa.d t0(String str, String str2, boolean z, long j2) {
p V0 = V0(str, str2, "", z);
h1(V0, j2);
if (V0.B()) {
return V0;
}
return null;
}
public String toString() {
StringBuilder sb2 = new StringBuilder(2048);
sb2.append("\t---- Local Host -----");
sb2.append("\n\t");
sb2.append(this.j);
sb2.append("\n\t---- Services -----");
for (String str : this.g.keySet()) {
sb2.append("\n\t\tService: ");
sb2.append(str);
sb2.append(": ");
sb2.append(this.g.get(str));
}
sb2.append("\n");
sb2.append("\t---- Types ----");
Iterator<String> it = this.h.keySet().iterator();
while (it.hasNext()) {
j jVar = this.h.get(it.next());
sb2.append("\n\t\tType: ");
sb2.append(jVar.f());
sb2.append(": ");
if (jVar.isEmpty()) {
jVar = "no subtypes";
}
sb2.append(jVar);
}
sb2.append("\n");
sb2.append(this.f.toString());
sb2.append("\n");
sb2.append("\t---- Service Collectors ----");
for (String str2 : this.x.keySet()) {
sb2.append("\n\t\tService Collector: ");
sb2.append(str2);
sb2.append(": ");
sb2.append(this.x.get(str2));
}
sb2.append("\n");
sb2.append("\t---- Service Listeners ----");
for (String str3 : this.d.keySet()) {
sb2.append("\n\t\tService Listener: ");
sb2.append(str3);
sb2.append(": ");
sb2.append(this.d.get(str3));
}
return sb2.toString();
}
@Override
public void u(xa.d dVar) throws IOException {
if (K0() || isClosed()) {
throw new IllegalStateException("This DNS is closed.");
}
p pVar = (p) dVar;
if (pVar.O() != null) {
if (pVar.O() != this) {
throw new IllegalStateException("A service information can only be registered with a single instamce of JmDNS.");
}
if (this.g.get(pVar.n()) != null) {
throw new IllegalStateException("A service information can only be registered once.");
}
}
pVar.f0(this);
Q0(pVar.R());
pVar.a0();
pVar.i0(this.j.q());
pVar.F(this.j.l());
pVar.G(this.j.n());
f1(6000L);
M0(pVar);
while (this.g.putIfAbsent(pVar.n(), pVar) != null) {
M0(pVar);
}
j();
pVar.k0(6000L);
if (E.isLoggable(Level.FINE)) {
E.fine("registerService() JmDNS registered service as " + pVar);
}
}
p u0(String str, String str2, String str3, boolean z) {
p pVar;
byte[] bArr;
String str4;
xa.d B;
xa.d B2;
xa.d B3;
xa.d B4;
p pVar2 = new p(str, str2, str3, 0, 0, 0, z, (byte[]) null);
ya.a b0 = b0();
za.d dVar = za.d.CLASS_ANY;
ya.b f2 = b0.f(new h.e(str, dVar, false, 0, pVar2.v()));
if (!(f2 instanceof ya.h) || (pVar = (p) ((ya.h) f2).B(z)) == null) {
return pVar2;
}
Map<d.a, String> Q = pVar.Q();
ya.b d2 = b0().d(pVar2.v(), za.e.TYPE_SRV, dVar);
if (!(d2 instanceof ya.h) || (B4 = ((ya.h) d2).B(z)) == null) {
bArr = null;
str4 = "";
} else {
p pVar3 = new p(Q, B4.p(), B4.A(), B4.r(), z, (byte[]) null);
byte[] y = B4.y();
str4 = B4.w();
bArr = y;
pVar = pVar3;
}
ya.b d3 = b0().d(str4, za.e.TYPE_A, dVar);
if ((d3 instanceof ya.h) && (B3 = ((ya.h) d3).B(z)) != null) {
for (Inet4Address inet4Address : B3.g()) {
pVar.F(inet4Address);
}
pVar.E(B3.y());
}
ya.b d4 = b0().d(str4, za.e.TYPE_AAAA, za.d.CLASS_ANY);
if ((d4 instanceof ya.h) && (B2 = ((ya.h) d4).B(z)) != null) {
for (Inet6Address inet6Address : B2.h()) {
pVar.G(inet6Address);
}
pVar.E(B2.y());
}
ya.b d5 = b0().d(pVar.v(), za.e.TYPE_TXT, za.d.CLASS_ANY);
if ((d5 instanceof ya.h) && (B = ((ya.h) d5).B(z)) != null) {
pVar.E(B.y());
}
if (pVar.y().length == 0) {
pVar.E(bArr);
}
return pVar.B() ? pVar : pVar2;
}
public Map<String, j> v0() {
return this.h;
}
@Override
public void w(String str, xa.e eVar) {
String lowerCase = str.toLowerCase();
List<m.a> list = this.d.get(lowerCase);
if (list != null) {
synchronized (list) {
list.remove(new m.a(eVar, false));
if (list.isEmpty()) {
this.d.remove(lowerCase, list);
}
}
}
}
public Map<String, xa.d> w0() {
return this.g;
}
public MulticastSocket x0() {
return this.b;
}
public int y0() {
return this.l;
}
@Override
public void z(String str, String str2, long j2) {
U0(str, str2, false, 6000L);
}
void z0(ya.c cVar, InetAddress inetAddress, int i2) throws IOException {
if (E.isLoggable(Level.FINE)) {
E.fine(getName() + ".handle query: " + cVar);
}
long currentTimeMillis = System.currentTimeMillis() + 120;
Iterator<? extends ya.h> it = cVar.b().iterator();
boolean z = false;
while (it.hasNext()) {
z |= it.next().D(this, currentTimeMillis);
}
E0();
try {
ya.c cVar2 = this.w;
if (cVar2 != null) {
cVar2.u(cVar);
} else {
ya.c clone = cVar.clone();
if (cVar.o()) {
this.w = clone;
}
i(clone, i2);
}
F0();
long currentTimeMillis2 = System.currentTimeMillis();
Iterator<? extends ya.h> it2 = cVar.c().iterator();
while (it2.hasNext()) {
A0(it2.next(), currentTimeMillis2);
}
if (z) {
j();
}
} catch (Throwable th) {
F0();
throw th;
}
}
public static class j extends AbstractMap<String, String> implements Cloneable {
private final Set<Map.Entry<String, String>> a = new HashSet();
private final String b;
public j(String str) {
this.b = str;
}
public boolean a(String str) {
if (str == null || c(str)) {
return false;
}
this.a.add(new a(str));
return true;
}
@Override
public j clone() {
j jVar = new j(f());
Iterator<Map.Entry<String, String>> it = entrySet().iterator();
while (it.hasNext()) {
jVar.a(it.next().getValue());
}
return jVar;
}
public boolean c(String str) {
return str != null && containsKey(str.toLowerCase());
}
@Override
public Set<Map.Entry<String, String>> entrySet() {
return this.a;
}
public String f() {
return this.b;
}
@Override
public String toString() {
StringBuilder sb2 = new StringBuilder(200);
if (isEmpty()) {
sb2.append("empty");
} else {
Iterator<String> it = values().iterator();
while (it.hasNext()) {
sb2.append(it.next());
sb2.append(", ");
}
sb2.setLength(sb2.length() - 2);
}
return sb2.toString();
}
private static class a implements Map.Entry<String, String>, Serializable, Cloneable {
private final String a;
private final String b;
public a(String str) {
str = str == null ? "" : str;
this.b = str;
this.a = str.toLowerCase();
}
@Override
public String getKey() {
return this.a;
}
@Override
public String getValue() {
return this.b;
}
@Override
public String setValue(String str) {
throw new UnsupportedOperationException();
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return getKey().equals(entry.getKey()) && getValue().equals(entry.getValue());
}
@Override
public int hashCode() {
String str = this.a;
int hashCode = str == null ? 0 : str.hashCode();
String str2 = this.b;
return hashCode ^ (str2 != null ? str2.hashCode() : 0);
}
public String toString() {
return this.a + "=" + this.b;
}
public a clone() {
return this;
}
}
}
public l d0() {
return this;
}
}