正在查看: Top浏览器 v4.6.16 应用的 u.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Top浏览器 v4.6.16 应用的 u.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package m.e.a.f;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Properties;
import org.adblockplus.libadblockplus.android.webview.AdblockWebView;
public class u {
public boolean a;
public int b;
public String f5307c;
public boolean f5308d;
public ServerSocket f5309e;
public c f5310f;
public static class b {
public static u a = new u();
}
public class c extends Thread {
public c() {
setDaemon(true);
setName("ShutdownMonitor");
}
public final void a() {
if (u.this.b < 0) {
if (u.this.a) {
System.err.println("ShutdownMonitor not in use (port < 0): " + u.this.b);
return;
}
return;
}
try {
try {
u.this.f5309e = new ServerSocket(u.this.b, 1, InetAddress.getByName("127.0.0.1"));
if (u.this.b == 0) {
u uVar = u.this;
uVar.b = uVar.f5309e.getLocalPort();
System.out.printf("STOP.PORT=%d%n", Integer.valueOf(u.this.b));
}
if (u.this.f5307c == null) {
u.this.f5307c = Long.toString((long) ((Math.random() * 9.223372036854776E18d) + hashCode() + System.currentTimeMillis()), 36);
System.out.printf("STOP.KEY=%s%n", u.this.f5307c);
}
u uVar2 = u.this;
uVar2.o("STOP.PORT=%d", Integer.valueOf(uVar2.b));
u uVar3 = u.this;
uVar3.o("STOP.KEY=%s", uVar3.f5307c);
u uVar4 = u.this;
uVar4.o("%s", uVar4.f5309e);
} catch (Exception e2) {
u.this.p(e2);
System.err.println("Error binding monitor port " + u.this.b + ": " + e2.toString());
u.this.f5309e = null;
u uVar5 = u.this;
uVar5.o("STOP.PORT=%d", Integer.valueOf(uVar5.b));
u uVar6 = u.this;
uVar6.o("STOP.KEY=%s", uVar6.f5307c);
u uVar7 = u.this;
uVar7.o("%s", uVar7.f5309e);
}
} catch (Throwable th) {
u uVar8 = u.this;
uVar8.o("STOP.PORT=%d", Integer.valueOf(uVar8.b));
u uVar9 = u.this;
uVar9.o("STOP.KEY=%s", uVar9.f5307c);
u uVar10 = u.this;
uVar10.o("%s", uVar10.f5309e);
throw th;
}
}
@Override
public void run() {
Socket socket;
Throwable th;
Exception e2;
LineNumberReader lineNumberReader;
if (u.this.f5309e == null) {
return;
}
while (u.this.f5309e != null) {
Socket socket2 = null;
try {
socket = u.this.f5309e.accept();
try {
try {
lineNumberReader = new LineNumberReader(new InputStreamReader(socket.getInputStream()));
} catch (Throwable th2) {
th = th2;
u.this.n(socket);
throw th;
}
} catch (Exception e3) {
e2 = e3;
u.this.p(e2);
System.err.println(e2.toString());
u.this.n(socket);
}
} catch (Exception e4) {
socket = null;
e2 = e4;
} catch (Throwable th3) {
socket = null;
th = th3;
}
if (u.this.f5307c.equals(lineNumberReader.readLine())) {
OutputStream outputStream = socket.getOutputStream();
String readLine = lineNumberReader.readLine();
u.this.o("command=%s", readLine);
if ("stop".equals(readLine)) {
u.this.o("Issuing graceful shutdown..", new Object[0]);
m.e.a.h.f0.c.b().run();
u.this.o("Informing client that we are stopped.", new Object[0]);
outputStream.write("Stopped\r\n".getBytes(AdblockWebView.WebResponseResult.RESPONSE_CHARSET_NAME));
outputStream.flush();
u.this.o("Shutting down monitor", new Object[0]);
u.this.n(socket);
u uVar = u.this;
uVar.m(uVar.f5309e);
u.this.f5309e = null;
if (u.this.f5308d) {
u.this.o("Killing JVM", new Object[0]);
System.exit(0);
}
} else {
if ("status".equals(readLine)) {
outputStream.write("OK\r\n".getBytes(AdblockWebView.WebResponseResult.RESPONSE_CHARSET_NAME));
outputStream.flush();
}
socket2 = socket;
}
u.this.n(socket2);
} else {
System.err.println("Ignoring command with incorrect key");
u.this.n(socket);
}
}
}
@Override
public void start() {
if (isAlive()) {
System.err.printf("ShutdownMonitorThread already started", new Object[0]);
return;
}
a();
if (u.this.f5309e == null) {
return;
}
if (u.this.a) {
System.err.println("Starting ShutdownMonitorThread");
}
super.start();
}
}
public static u q() {
return b.a;
}
public final void m(ServerSocket serverSocket) {
if (serverSocket == null) {
return;
}
try {
serverSocket.close();
} catch (IOException unused) {
}
}
public final void n(Socket socket) {
if (socket == null) {
return;
}
try {
socket.close();
} catch (IOException unused) {
}
}
public final void o(String str, Object... objArr) {
if (this.a) {
System.err.printf("[ShutdownMonitor] " + str + "%n", objArr);
}
}
public final void p(Throwable th) {
if (this.a) {
th.printStackTrace(System.err);
}
}
public void r() {
synchronized (this) {
c cVar = this.f5310f;
if (cVar != null && cVar.isAlive()) {
System.err.printf("ShutdownMonitorThread already started", new Object[0]);
return;
}
c cVar2 = new c();
this.f5310f = cVar2;
if (cVar2 != null) {
cVar2.start();
}
}
}
public String toString() {
return String.format("%s[port=%d]", u.class.getName(), Integer.valueOf(this.b));
}
public u() {
Properties properties = System.getProperties();
this.a = properties.containsKey("DEBUG");
this.b = Integer.parseInt(properties.getProperty("STOP.PORT", "-1"));
this.f5307c = properties.getProperty("STOP.KEY", null);
this.f5308d = true;
}
}