导航菜单

页面标题

页面副标题

Zepto v25.1.4 - SocketReceiver.java 源代码

正在查看: Zepto v25.1.4 应用的 SocketReceiver.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package ch.qos.logback.classic.net;

import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.net.server.HardenedLoggingEventInputStream;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.net.DefaultSocketConnector;
import ch.qos.logback.core.net.SocketConnector;
import ch.qos.logback.core.util.CloseUtil;
import java.io.EOFException;
import java.io.IOException;
import java.net.ConnectException;
import java.net.Socket;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import javax.net.SocketFactory;

public class SocketReceiver extends ReceiverBase implements Runnable, SocketConnector.ExceptionHandler {
    public int e;
    public final int f = 5000;
    public volatile Socket g;
    public Future h;

    @Override
    public final Runnable P1() {
        return this;
    }

    @Override
    public final void U1() {
        if (this.g != null) {
            CloseUtil.b(this.g);
        }
    }

    @Override
    public boolean X1() {
        r("No port was configured for receiver. For more information, please visit http://logback.qos.ch/codes.html#receiver_no_port");
        r("No host name or address was configured for receiver. For more information, please visit http://logback.qos.ch/codes.html#receiver_no_host");
        if (this.e != 0) {
            return false;
        }
        this.e = 30000;
        return false;
    }

    @Override
    public final void h(IOException iOException) {
        if (iOException instanceof InterruptedException) {
            P("connector interrupted");
        } else {
            if (iOException instanceof ConnectException) {
                P("nullconnection refused");
                return;
            }
            P("null" + iOException);
        }
    }

    @Override
    public final void run() {
        Future future;
        try {
            LoggerContext loggerContext = (LoggerContext) this.f6770b;
            while (!Thread.currentThread().isInterrupted()) {
                DefaultSocketConnector defaultSocketConnector = new DefaultSocketConnector(null, 0, 0, this.e);
                defaultSocketConnector.d = this;
                defaultSocketConnector.e = y2();
                Socket socket = null;
                try {
                    future = this.f6770b.D().submit(defaultSocketConnector);
                } catch (RejectedExecutionException unused) {
                    future = null;
                }
                this.h = future;
                if (future == null) {
                    break;
                }
                try {
                    socket = (Socket) future.get();
                } catch (ExecutionException unused2) {
                }
                this.g = socket;
                if (this.g == null) {
                    break;
                } else {
                    s2(loggerContext);
                }
            }
        } catch (InterruptedException unused3) {
        }
        P("shutting down");
    }

    public final void s2(LoggerContext loggerContext) {
        HardenedLoggingEventInputStream hardenedLoggingEventInputStream;
        try {
            try {
                this.g.setSoTimeout(this.f);
                hardenedLoggingEventInputStream = new HardenedLoggingEventInputStream(this.g.getInputStream());
                try {
                    this.g.setSoTimeout(0);
                    P("nullconnection established");
                    while (true) {
                        ILoggingEvent iLoggingEvent = (ILoggingEvent) hardenedLoggingEventInputStream.readObject();
                        Logger a2 = loggerContext.a(iLoggingEvent.k());
                        if (a2.g(iLoggingEvent.getLevel())) {
                            a2.b(iLoggingEvent);
                        }
                    }
                } catch (EOFException unused) {
                    P(((String) null) + "end-of-stream detected");
                    CloseUtil.a(hardenedLoggingEventInputStream);
                    CloseUtil.b(this.g);
                    this.g = null;
                    P("nullconnection closed");
                } catch (IOException e) {
                    e = e;
                    P(((String) null) + "connection failed: " + e);
                    CloseUtil.a(hardenedLoggingEventInputStream);
                    CloseUtil.b(this.g);
                    this.g = null;
                    P("nullconnection closed");
                } catch (ClassNotFoundException e2) {
                    e = e2;
                    P(((String) null) + "unknown event class: " + e);
                    CloseUtil.a(hardenedLoggingEventInputStream);
                    CloseUtil.b(this.g);
                    this.g = null;
                    P("nullconnection closed");
                }
            } catch (Throwable th) {
                th = th;
                CloseUtil.a(null);
                CloseUtil.b(this.g);
                this.g = null;
                P("nullconnection closed");
                throw th;
            }
        } catch (EOFException unused2) {
            hardenedLoggingEventInputStream = null;
        } catch (IOException e3) {
            e = e3;
            hardenedLoggingEventInputStream = null;
        } catch (ClassNotFoundException e4) {
            e = e4;
            hardenedLoggingEventInputStream = null;
        } catch (Throwable th2) {
            th = th2;
            CloseUtil.a(null);
            CloseUtil.b(this.g);
            this.g = null;
            P("nullconnection closed");
            throw th;
        }
    }

    public SocketFactory y2() {
        return SocketFactory.getDefault();
    }
}