导航菜单

页面标题

页面副标题

⁣逼‌多​多⁣ v3.6.2 - InternalChannelz.java 源代码

正在查看: ⁣逼‌多​多⁣ v3.6.2 应用的 InternalChannelz.java JAVA 源代码文件

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


package io.grpc;

import java.net.SocketAddress;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import q.g;
import q.i;
import q.l;

@Internal
public final class InternalChannelz {
    static final boolean $assertionsDisabled = false;
    private static final Logger log = Logger.getLogger(InternalChannelz.class.getName());
    private static final InternalChannelz INSTANCE = new InternalChannelz();
    private final ConcurrentNavigableMap<Long, InternalInstrumented<ServerStats>> servers = new ConcurrentSkipListMap();
    private final ConcurrentNavigableMap<Long, InternalInstrumented<ChannelStats>> rootChannels = new ConcurrentSkipListMap();
    private final ConcurrentMap<Long, InternalInstrumented<ChannelStats>> subchannels = new ConcurrentHashMap();
    private final ConcurrentMap<Long, InternalInstrumented<SocketStats>> otherSockets = new ConcurrentHashMap();
    private final ConcurrentMap<Long, ServerSocketMap> perServerSockets = new ConcurrentHashMap();

    public static final class ChannelStats {
        public final long callsFailed;
        public final long callsStarted;
        public final long callsSucceeded;
        public final ChannelTrace channelTrace;
        public final long lastCallStartedNanos;
        public final List<InternalWithLogId> sockets;
        public final ConnectivityState state;
        public final List<InternalWithLogId> subchannels;
        public final String target;

        public static final class Builder {
            private long callsFailed;
            private long callsStarted;
            private long callsSucceeded;
            private ChannelTrace channelTrace;
            private long lastCallStartedNanos;
            private ConnectivityState state;
            private String target;
            private List<InternalWithLogId> subchannels = Collections.emptyList();
            private List<InternalWithLogId> sockets = Collections.emptyList();

            public ChannelStats build() {
                return new ChannelStats(this.target, this.state, this.channelTrace, this.callsStarted, this.callsSucceeded, this.callsFailed, this.lastCallStartedNanos, this.subchannels, this.sockets);
            }

            public Builder setCallsFailed(long j) {
                this.callsFailed = j;
                return this;
            }

            public Builder setCallsStarted(long j) {
                this.callsStarted = j;
                return this;
            }

            public Builder setCallsSucceeded(long j) {
                this.callsSucceeded = j;
                return this;
            }

            public Builder setChannelTrace(ChannelTrace channelTrace) {
                this.channelTrace = channelTrace;
                return this;
            }

            public Builder setLastCallStartedNanos(long j) {
                this.lastCallStartedNanos = j;
                return this;
            }

            public Builder setSockets(List<InternalWithLogId> list) {
                l.t(this.subchannels.isEmpty());
                this.sockets = Collections.unmodifiableList((List) l.n(list));
                return this;
            }

            public Builder setState(ConnectivityState connectivityState) {
                this.state = connectivityState;
                return this;
            }

            public Builder setSubchannels(List<InternalWithLogId> list) {
                l.t(this.sockets.isEmpty());
                this.subchannels = Collections.unmodifiableList((List) l.n(list));
                return this;
            }

            public Builder setTarget(String str) {
                this.target = str;
                return this;
            }
        }

        private ChannelStats(String str, ConnectivityState connectivityState, ChannelTrace channelTrace, long j, long j3, long j4, long j5, List<InternalWithLogId> list, List<InternalWithLogId> list2) {
            l.u(list.isEmpty() || list2.isEmpty(), "channels can have subchannels only, subchannels can have either sockets OR subchannels, neither can have both");
            this.target = str;
            this.state = connectivityState;
            this.channelTrace = channelTrace;
            this.callsStarted = j;
            this.callsSucceeded = j3;
            this.callsFailed = j4;
            this.lastCallStartedNanos = j5;
            this.subchannels = (List) l.n(list);
            this.sockets = (List) l.n(list2);
        }
    }

    public static final class ChannelTrace {
        public final long creationTimeNanos;
        public final List<Event> events;
        public final long numEventsLogged;

        public static final class Builder {
            private Long creationTimeNanos;
            private List<Event> events = Collections.emptyList();
            private Long numEventsLogged;

            public ChannelTrace build() {
                l.o(this.numEventsLogged, "numEventsLogged");
                l.o(this.creationTimeNanos, "creationTimeNanos");
                return new ChannelTrace(this.numEventsLogged.longValue(), this.creationTimeNanos.longValue(), this.events);
            }

            public Builder setCreationTimeNanos(long j) {
                this.creationTimeNanos = Long.valueOf(j);
                return this;
            }

            public Builder setEvents(List<Event> list) {
                this.events = Collections.unmodifiableList(new ArrayList(list));
                return this;
            }

            public Builder setNumEventsLogged(long j) {
                this.numEventsLogged = Long.valueOf(j);
                return this;
            }
        }

        public static final class Event {
            public final InternalWithLogId channelRef;
            public final String description;
            public final Severity severity;
            public final InternalWithLogId subchannelRef;
            public final long timestampNanos;

            public static final class Builder {
                private InternalWithLogId channelRef;
                private String description;
                private Severity severity;
                private InternalWithLogId subchannelRef;
                private Long timestampNanos;

                public Event build() {
                    l.o(this.description, "description");
                    l.o(this.severity, "severity");
                    l.o(this.timestampNanos, "timestampNanos");
                    l.u(this.channelRef == null || this.subchannelRef == null, "at least one of channelRef and subchannelRef must be null");
                    return new Event(this.description, this.severity, this.timestampNanos.longValue(), this.channelRef, this.subchannelRef);
                }

                public Builder setChannelRef(InternalWithLogId internalWithLogId) {
                    this.channelRef = internalWithLogId;
                    return this;
                }

                public Builder setDescription(String str) {
                    this.description = str;
                    return this;
                }

                public Builder setSeverity(Severity severity) {
                    this.severity = severity;
                    return this;
                }

                public Builder setSubchannelRef(InternalWithLogId internalWithLogId) {
                    this.subchannelRef = internalWithLogId;
                    return this;
                }

                public Builder setTimestampNanos(long j) {
                    this.timestampNanos = Long.valueOf(j);
                    return this;
                }
            }

            public enum Severity {
                CT_UNKNOWN,
                CT_INFO,
                CT_WARNING,
                CT_ERROR
            }

            public boolean equals(Object obj) {
                if (!(obj instanceof Event)) {
                    return false;
                }
                Event event = (Event) obj;
                return i.a(this.description, event.description) && i.a(this.severity, event.severity) && this.timestampNanos == event.timestampNanos && i.a(this.channelRef, event.channelRef) && i.a(this.subchannelRef, event.subchannelRef);
            }

            public int hashCode() {
                return i.b(new Object[]{this.description, this.severity, Long.valueOf(this.timestampNanos), this.channelRef, this.subchannelRef});
            }

            public String toString() {
                return g.c(this).d("description", this.description).d("severity", this.severity).c("timestampNanos", this.timestampNanos).d("channelRef", this.channelRef).d("subchannelRef", this.subchannelRef).toString();
            }

            private Event(String str, Severity severity, long j, InternalWithLogId internalWithLogId, InternalWithLogId internalWithLogId2) {
                this.description = str;
                this.severity = (Severity) l.o(severity, "severity");
                this.timestampNanos = j;
                this.channelRef = internalWithLogId;
                this.subchannelRef = internalWithLogId2;
            }
        }

        private ChannelTrace(long j, long j3, List<Event> list) {
            this.numEventsLogged = j;
            this.creationTimeNanos = j3;
            this.events = list;
        }
    }

    public static final class OtherSecurity {
        public final Object any;
        public final String name;

        public OtherSecurity(String str, Object obj) {
            this.name = (String) l.n(str);
            l.u(obj == null || obj.getClass().getName().endsWith("com.google.protobuf.Any"), "the 'any' object must be of type com.google.protobuf.Any");
            this.any = obj;
        }
    }

    public static final class RootChannelList {
        public final List<InternalInstrumented<ChannelStats>> channels;
        public final boolean end;

        public RootChannelList(List<InternalInstrumented<ChannelStats>> list, boolean z) {
            this.channels = (List) l.n(list);
            this.end = z;
        }
    }

    public static final class ServerList {
        public final boolean end;
        public final List<InternalInstrumented<ServerStats>> servers;

        public ServerList(List<InternalInstrumented<ServerStats>> list, boolean z) {
            this.servers = (List) l.n(list);
            this.end = z;
        }
    }

    private static final class ServerSocketMap extends ConcurrentSkipListMap<Long, InternalInstrumented<SocketStats>> {
        private static final long serialVersionUID = -7883772124944661414L;

        private ServerSocketMap() {
        }
    }

    public static final class ServerSocketsList {
        public final boolean end;
        public final List<InternalWithLogId> sockets;

        public ServerSocketsList(List<InternalWithLogId> list, boolean z) {
            this.sockets = list;
            this.end = z;
        }
    }

    public static final class ServerStats {
        public final long callsFailed;
        public final long callsStarted;
        public final long callsSucceeded;
        public final long lastCallStartedNanos;
        public final List<InternalInstrumented<SocketStats>> listenSockets;

        public static final class Builder {
            private long callsFailed;
            private long callsStarted;
            private long callsSucceeded;
            private long lastCallStartedNanos;
            public List<InternalInstrumented<SocketStats>> listenSockets = new ArrayList();

            public Builder addListenSockets(List<InternalInstrumented<SocketStats>> list) {
                l.o(list, "listenSockets");
                Iterator<InternalInstrumented<SocketStats>> it = list.iterator();
                while (it.hasNext()) {
                    this.listenSockets.add((InternalInstrumented) l.o(it.next(), "null listen socket"));
                }
                return this;
            }

            public ServerStats build() {
                return new ServerStats(this.callsStarted, this.callsSucceeded, this.callsFailed, this.lastCallStartedNanos, this.listenSockets);
            }

            public Builder setCallsFailed(long j) {
                this.callsFailed = j;
                return this;
            }

            public Builder setCallsStarted(long j) {
                this.callsStarted = j;
                return this;
            }

            public Builder setCallsSucceeded(long j) {
                this.callsSucceeded = j;
                return this;
            }

            public Builder setLastCallStartedNanos(long j) {
                this.lastCallStartedNanos = j;
                return this;
            }
        }

        public ServerStats(long j, long j3, long j4, long j5, List<InternalInstrumented<SocketStats>> list) {
            this.callsStarted = j;
            this.callsSucceeded = j3;
            this.callsFailed = j4;
            this.lastCallStartedNanos = j5;
            this.listenSockets = (List) l.n(list);
        }
    }

    public static final class SocketOptions {
        public final Integer lingerSeconds;
        public final Map<String, String> others;
        public final Integer soTimeoutMillis;
        public final TcpInfo tcpInfo;

        public static final class Builder {
            private Integer lingerSeconds;
            private final Map<String, String> others = new HashMap();
            private TcpInfo tcpInfo;
            private Integer timeoutMillis;

            public Builder addOption(String str, String str2) {
                this.others.put(str, (String) l.n(str2));
                return this;
            }

            public SocketOptions build() {
                return new SocketOptions(this.timeoutMillis, this.lingerSeconds, this.tcpInfo, this.others);
            }

            public Builder setSocketOptionLingerSeconds(Integer num) {
                this.lingerSeconds = num;
                return this;
            }

            public Builder setSocketOptionTimeoutMillis(Integer num) {
                this.timeoutMillis = num;
                return this;
            }

            public Builder setTcpInfo(TcpInfo tcpInfo) {
                this.tcpInfo = tcpInfo;
                return this;
            }

            public Builder addOption(String str, int i) {
                this.others.put(str, Integer.toString(i));
                return this;
            }

            public Builder addOption(String str, boolean z) {
                this.others.put(str, Boolean.toString(z));
                return this;
            }
        }

        public SocketOptions(Integer num, Integer num2, TcpInfo tcpInfo, Map<String, String> map) {
            l.n(map);
            this.soTimeoutMillis = num;
            this.lingerSeconds = num2;
            this.tcpInfo = tcpInfo;
            this.others = Collections.unmodifiableMap(new HashMap(map));
        }
    }

    public static final class SocketStats {
        public final TransportStats data;
        public final SocketAddress local;
        public final SocketAddress remote;
        public final Security security;
        public final SocketOptions socketOptions;

        public SocketStats(TransportStats transportStats, SocketAddress socketAddress, SocketAddress socketAddress2, SocketOptions socketOptions, Security security) {
            this.data = transportStats;
            this.local = (SocketAddress) l.o(socketAddress, "local socket");
            this.remote = socketAddress2;
            this.socketOptions = (SocketOptions) l.n(socketOptions);
            this.security = security;
        }
    }

    public static final class TcpInfo {
        public final int advmss;
        public final int ato;
        public final int backoff;
        public final int caState;
        public final int fackets;
        public final int lastAckRecv;
        public final int lastAckSent;
        public final int lastDataRecv;
        public final int lastDataSent;
        public final int lost;
        public final int options;
        public final int pmtu;
        public final int probes;
        public final int rcvMss;
        public final int rcvSsthresh;
        public final int rcvWscale;
        public final int reordering;
        public final int retrans;
        public final int retransmits;
        public final int rto;
        public final int rtt;
        public final int rttvar;
        public final int sacked;
        public final int sndCwnd;
        public final int sndMss;
        public final int sndSsthresh;
        public final int sndWscale;
        public final int state;
        public final int unacked;

        public static final class Builder {
            private int advmss;
            private int ato;
            private int backoff;
            private int caState;
            private int fackets;
            private int lastAckRecv;
            private int lastAckSent;
            private int lastDataRecv;
            private int lastDataSent;
            private int lost;
            private int options;
            private int pmtu;
            private int probes;
            private int rcvMss;
            private int rcvSsthresh;
            private int rcvWscale;
            private int reordering;
            private int retrans;
            private int retransmits;
            private int rto;
            private int rtt;
            private int rttvar;
            private int sacked;
            private int sndCwnd;
            private int sndMss;
            private int sndSsthresh;
            private int sndWscale;
            private int state;
            private int unacked;

            public TcpInfo build() {
                return new TcpInfo(this.state, this.caState, this.retransmits, this.probes, this.backoff, this.options, this.sndWscale, this.rcvWscale, this.rto, this.ato, this.sndMss, this.rcvMss, this.unacked, this.sacked, this.lost, this.retrans, this.fackets, this.lastDataSent, this.lastAckSent, this.lastDataRecv, this.lastAckRecv, this.pmtu, this.rcvSsthresh, this.rtt, this.rttvar, this.sndSsthresh, this.sndCwnd, this.advmss, this.reordering);
            }

            public Builder setAdvmss(int i) {
                this.advmss = i;
                return this;
            }

            public Builder setAto(int i) {
                this.ato = i;
                return this;
            }

            public Builder setBackoff(int i) {
                this.backoff = i;
                return this;
            }

            public Builder setCaState(int i) {
                this.caState = i;
                return this;
            }

            public Builder setFackets(int i) {
                this.fackets = i;
                return this;
            }

            public Builder setLastAckRecv(int i) {
                this.lastAckRecv = i;
                return this;
            }

            public Builder setLastAckSent(int i) {
                this.lastAckSent = i;
                return this;
            }

            public Builder setLastDataRecv(int i) {
                this.lastDataRecv = i;
                return this;
            }

            public Builder setLastDataSent(int i) {
                this.lastDataSent = i;
                return this;
            }

            public Builder setLost(int i) {
                this.lost = i;
                return this;
            }

            public Builder setOptions(int i) {
                this.options = i;
                return this;
            }

            public Builder setPmtu(int i) {
                this.pmtu = i;
                return this;
            }

            public Builder setProbes(int i) {
                this.probes = i;
                return this;
            }

            public Builder setRcvMss(int i) {
                this.rcvMss = i;
                return this;
            }

            public Builder setRcvSsthresh(int i) {
                this.rcvSsthresh = i;
                return this;
            }

            public Builder setRcvWscale(int i) {
                this.rcvWscale = i;
                return this;
            }

            public Builder setReordering(int i) {
                this.reordering = i;
                return this;
            }

            public Builder setRetrans(int i) {
                this.retrans = i;
                return this;
            }

            public Builder setRetransmits(int i) {
                this.retransmits = i;
                return this;
            }

            public Builder setRto(int i) {
                this.rto = i;
                return this;
            }

            public Builder setRtt(int i) {
                this.rtt = i;
                return this;
            }

            public Builder setRttvar(int i) {
                this.rttvar = i;
                return this;
            }

            public Builder setSacked(int i) {
                this.sacked = i;
                return this;
            }

            public Builder setSndCwnd(int i) {
                this.sndCwnd = i;
                return this;
            }

            public Builder setSndMss(int i) {
                this.sndMss = i;
                return this;
            }

            public Builder setSndSsthresh(int i) {
                this.sndSsthresh = i;
                return this;
            }

            public Builder setSndWscale(int i) {
                this.sndWscale = i;
                return this;
            }

            public Builder setState(int i) {
                this.state = i;
                return this;
            }

            public Builder setUnacked(int i) {
                this.unacked = i;
                return this;
            }
        }

        TcpInfo(int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20, int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29) {
            this.state = i;
            this.caState = i2;
            this.retransmits = i3;
            this.probes = i4;
            this.backoff = i5;
            this.options = i6;
            this.sndWscale = i7;
            this.rcvWscale = i8;
            this.rto = i9;
            this.ato = i10;
            this.sndMss = i11;
            this.rcvMss = i12;
            this.unacked = i13;
            this.sacked = i14;
            this.lost = i15;
            this.retrans = i16;
            this.fackets = i17;
            this.lastDataSent = i18;
            this.lastAckSent = i19;
            this.lastDataRecv = i20;
            this.lastAckRecv = i21;
            this.pmtu = i22;
            this.rcvSsthresh = i23;
            this.rtt = i24;
            this.rttvar = i25;
            this.sndSsthresh = i26;
            this.sndCwnd = i27;
            this.advmss = i28;
            this.reordering = i29;
        }
    }

    public static final class TransportStats {
        public final long keepAlivesSent;
        public final long lastLocalStreamCreatedTimeNanos;
        public final long lastMessageReceivedTimeNanos;
        public final long lastMessageSentTimeNanos;
        public final long lastRemoteStreamCreatedTimeNanos;
        public final long localFlowControlWindow;
        public final long messagesReceived;
        public final long messagesSent;
        public final long remoteFlowControlWindow;
        public final long streamsFailed;
        public final long streamsStarted;
        public final long streamsSucceeded;

        public TransportStats(long j, long j3, long j4, long j5, long j6, long j7, long j8, long j9, long j10, long j11, long j12, long j13) {
            this.streamsStarted = j;
            this.lastLocalStreamCreatedTimeNanos = j3;
            this.lastRemoteStreamCreatedTimeNanos = j4;
            this.streamsSucceeded = j5;
            this.streamsFailed = j6;
            this.messagesSent = j7;
            this.messagesReceived = j8;
            this.keepAlivesSent = j9;
            this.lastMessageSentTimeNanos = j10;
            this.lastMessageReceivedTimeNanos = j11;
            this.localFlowControlWindow = j12;
            this.remoteFlowControlWindow = j13;
        }
    }

    private static <T extends InternalInstrumented<?>> void add(Map<Long, T> map, T t) {
        map.put(Long.valueOf(t.getLogId().getId()), t);
    }

    private static <T extends InternalInstrumented<?>> boolean contains(Map<Long, T> map, InternalLogId internalLogId) {
        return map.containsKey(Long.valueOf(internalLogId.getId()));
    }

    private InternalInstrumented<SocketStats> getServerSocket(long j) {
        Iterator<ServerSocketMap> it = this.perServerSockets.values().iterator();
        while (it.hasNext()) {
            InternalInstrumented<SocketStats> internalInstrumented = it.next().get(Long.valueOf(j));
            if (internalInstrumented != null) {
                return internalInstrumented;
            }
        }
        return null;
    }

    public static long id(InternalWithLogId internalWithLogId) {
        return internalWithLogId.getLogId().getId();
    }

    public static InternalChannelz instance() {
        return INSTANCE;
    }

    private static <T extends InternalInstrumented<?>> void remove(Map<Long, T> map, T t) {
        map.remove(Long.valueOf(id(t)));
    }

    public void addClientSocket(InternalInstrumented<SocketStats> internalInstrumented) {
        add(this.otherSockets, internalInstrumented);
    }

    public void addListenSocket(InternalInstrumented<SocketStats> internalInstrumented) {
        add(this.otherSockets, internalInstrumented);
    }

    public void addRootChannel(InternalInstrumented<ChannelStats> internalInstrumented) {
        add(this.rootChannels, internalInstrumented);
    }

    public void addServer(InternalInstrumented<ServerStats> internalInstrumented) {
        this.perServerSockets.put(Long.valueOf(id(internalInstrumented)), new ServerSocketMap());
        add(this.servers, internalInstrumented);
    }

    public void addServerSocket(InternalInstrumented<ServerStats> internalInstrumented, InternalInstrumented<SocketStats> internalInstrumented2) {
        add(this.perServerSockets.get(Long.valueOf(id(internalInstrumented))), internalInstrumented2);
    }

    public void addSubchannel(InternalInstrumented<ChannelStats> internalInstrumented) {
        add(this.subchannels, internalInstrumented);
    }

    public boolean containsClientSocket(InternalLogId internalLogId) {
        return contains(this.otherSockets, internalLogId);
    }

    public boolean containsServer(InternalLogId internalLogId) {
        return contains(this.servers, internalLogId);
    }

    public boolean containsSubchannel(InternalLogId internalLogId) {
        return contains(this.subchannels, internalLogId);
    }

    public InternalInstrumented<ChannelStats> getChannel(long j) {
        return this.rootChannels.get(Long.valueOf(j));
    }

    public InternalInstrumented<ChannelStats> getRootChannel(long j) {
        return this.rootChannels.get(Long.valueOf(j));
    }

    public RootChannelList getRootChannels(long j, int i) {
        ArrayList arrayList = new ArrayList();
        Iterator<InternalInstrumented<ChannelStats>> it = this.rootChannels.tailMap((ConcurrentNavigableMap<Long, InternalInstrumented<ChannelStats>>) Long.valueOf(j)).values().iterator();
        while (it.hasNext() && arrayList.size() < i) {
            arrayList.add(it.next());
        }
        return new RootChannelList(arrayList, !it.hasNext());
    }

    public InternalInstrumented<ServerStats> getServer(long j) {
        return this.servers.get(Long.valueOf(j));
    }

    public ServerSocketsList getServerSockets(long j, long j3, int i) {
        ServerSocketMap serverSocketMap = this.perServerSockets.get(Long.valueOf(j));
        if (serverSocketMap == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList(i);
        Iterator<InternalInstrumented<SocketStats>> it = serverSocketMap.tailMap((ServerSocketMap) Long.valueOf(j3)).values().iterator();
        while (arrayList.size() < i && it.hasNext()) {
            arrayList.add(it.next());
        }
        return new ServerSocketsList(arrayList, !it.hasNext());
    }

    public ServerList getServers(long j, int i) {
        ArrayList arrayList = new ArrayList(i);
        Iterator<InternalInstrumented<ServerStats>> it = this.servers.tailMap((ConcurrentNavigableMap<Long, InternalInstrumented<ServerStats>>) Long.valueOf(j)).values().iterator();
        while (it.hasNext() && arrayList.size() < i) {
            arrayList.add(it.next());
        }
        return new ServerList(arrayList, !it.hasNext());
    }

    public InternalInstrumented<SocketStats> getSocket(long j) {
        InternalInstrumented<SocketStats> internalInstrumented = this.otherSockets.get(Long.valueOf(j));
        return internalInstrumented != null ? internalInstrumented : getServerSocket(j);
    }

    public InternalInstrumented<ChannelStats> getSubchannel(long j) {
        return this.subchannels.get(Long.valueOf(j));
    }

    public void removeClientSocket(InternalInstrumented<SocketStats> internalInstrumented) {
        remove(this.otherSockets, internalInstrumented);
    }

    public void removeListenSocket(InternalInstrumented<SocketStats> internalInstrumented) {
        remove(this.otherSockets, internalInstrumented);
    }

    public void removeRootChannel(InternalInstrumented<ChannelStats> internalInstrumented) {
        remove(this.rootChannels, internalInstrumented);
    }

    public void removeServer(InternalInstrumented<ServerStats> internalInstrumented) {
        remove(this.servers, internalInstrumented);
        this.perServerSockets.remove(Long.valueOf(id(internalInstrumented)));
    }

    public void removeServerSocket(InternalInstrumented<ServerStats> internalInstrumented, InternalInstrumented<SocketStats> internalInstrumented2) {
        remove(this.perServerSockets.get(Long.valueOf(id(internalInstrumented))), internalInstrumented2);
    }

    public void removeSubchannel(InternalInstrumented<ChannelStats> internalInstrumented) {
        remove(this.subchannels, internalInstrumented);
    }

    public static final class Security {
        public final OtherSecurity other;
        public final Tls tls;

        public Security(Tls tls) {
            this.tls = (Tls) l.n(tls);
            this.other = null;
        }

        public Security(OtherSecurity otherSecurity) {
            this.tls = null;
            this.other = (OtherSecurity) l.n(otherSecurity);
        }
    }

    public static final class Tls {
        public final String cipherSuiteStandardName;
        public final Certificate localCert;
        public final Certificate remoteCert;

        public Tls(String str, Certificate certificate, Certificate certificate2) {
            this.cipherSuiteStandardName = str;
            this.localCert = certificate;
            this.remoteCert = certificate2;
        }

        public Tls(SSLSession sSLSession) {
            String cipherSuite = sSLSession.getCipherSuite();
            Certificate[] localCertificates = sSLSession.getLocalCertificates();
            Certificate certificate = null;
            Certificate certificate2 = localCertificates != null ? localCertificates[0] : null;
            try {
                Certificate[] peerCertificates = sSLSession.getPeerCertificates();
                if (peerCertificates != null) {
                    certificate = peerCertificates[0];
                }
            } catch (SSLPeerUnverifiedException e) {
                InternalChannelz.log.log(Level.FINE, String.format("Peer cert not available for peerHost=%s", sSLSession.getPeerHost()), (Throwable) e);
            }
            this.cipherSuiteStandardName = cipherSuite;
            this.localCert = certificate2;
            this.remoteCert = certificate;
        }
    }
}