@Test public void serverSocket_noServer() { assertNull(channelz.getServerSockets( 1, 0, 1)); }
@Nullable public ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize) { ServerSocketMap serverSockets = perServerSockets.get(serverId); if (serverSockets == null) { return null; } List<InternalWithLogId> socketList = new ArrayList<>(maxPageSize); Iterator<InternalInstrumented<SocketStats>> iterator = serverSockets.tailMap(fromId).values().iterator(); while (socketList.size() < maxPageSize && iterator.hasNext()) { socketList.add(iterator.next()); } return new ServerSocketsList(socketList, !iterator.hasNext()); }
InternalChannelz { @Nullable public ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize) { ServerSocketMap serverSockets = perServerSockets.get(serverId); if (serverSockets == null) { return null; } List<InternalWithLogId> socketList = new ArrayList<>(maxPageSize); Iterator<InternalInstrumented<SocketStats>> iterator = serverSockets.tailMap(fromId).values().iterator(); while (socketList.size() < maxPageSize && iterator.hasNext()) { socketList.add(iterator.next()); } return new ServerSocketsList(socketList, !iterator.hasNext()); } }
InternalChannelz { @Nullable public ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize) { ServerSocketMap serverSockets = perServerSockets.get(serverId); if (serverSockets == null) { return null; } List<InternalWithLogId> socketList = new ArrayList<>(maxPageSize); Iterator<InternalInstrumented<SocketStats>> iterator = serverSockets.tailMap(fromId).values().iterator(); while (socketList.size() < maxPageSize && iterator.hasNext()) { socketList.add(iterator.next()); } return new ServerSocketsList(socketList, !iterator.hasNext()); } @VisibleForTesting  InternalChannelz(); }
InternalChannelz { @Nullable public ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize) { ServerSocketMap serverSockets = perServerSockets.get(serverId); if (serverSockets == null) { return null; } List<InternalWithLogId> socketList = new ArrayList<>(maxPageSize); Iterator<InternalInstrumented<SocketStats>> iterator = serverSockets.tailMap(fromId).values().iterator(); while (socketList.size() < maxPageSize && iterator.hasNext()) { socketList.add(iterator.next()); } return new ServerSocketsList(socketList, !iterator.hasNext()); } @VisibleForTesting  InternalChannelz(); static InternalChannelz instance(); void addServer(InternalInstrumented<ServerStats> server); void addSubchannel(InternalInstrumented<ChannelStats> subchannel); void addRootChannel(InternalInstrumented<ChannelStats> rootChannel); void addClientSocket(InternalInstrumented<SocketStats> socket); void addListenSocket(InternalInstrumented<SocketStats> socket); void addServerSocket(
      InternalInstrumented<ServerStats> server, InternalInstrumented<SocketStats> socket); void removeServer(InternalInstrumented<ServerStats> server); void removeSubchannel(InternalInstrumented<ChannelStats> subchannel); void removeRootChannel(InternalInstrumented<ChannelStats> channel); void removeClientSocket(InternalInstrumented<SocketStats> socket); void removeListenSocket(InternalInstrumented<SocketStats> socket); void removeServerSocket(
      InternalInstrumented<ServerStats> server, InternalInstrumented<SocketStats> socket); RootChannelList getRootChannels(long fromId, int maxPageSize); @Nullable InternalInstrumented<ChannelStats> getChannel(long id); @Nullable InternalInstrumented<ChannelStats> getSubchannel(long id); ServerList getServers(long fromId, int maxPageSize); @Nullable ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize); @Nullable InternalInstrumented<SocketStats> getSocket(long id); @VisibleForTesting boolean containsServer(InternalLogId serverRef); @VisibleForTesting boolean containsSubchannel(InternalLogId subchannelRef); InternalInstrumented<ChannelStats> getRootChannel(long id); @VisibleForTesting boolean containsClientSocket(InternalLogId transportRef); static long id(InternalWithLogId withLogId); }
InternalChannelz { @Nullable public ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize) { ServerSocketMap serverSockets = perServerSockets.get(serverId); if (serverSockets == null) { return null; } List<InternalWithLogId> socketList = new ArrayList<>(maxPageSize); Iterator<InternalInstrumented<SocketStats>> iterator = serverSockets.tailMap(fromId).values().iterator(); while (socketList.size() < maxPageSize && iterator.hasNext()) { socketList.add(iterator.next()); } return new ServerSocketsList(socketList, !iterator.hasNext()); } @VisibleForTesting  InternalChannelz(); static InternalChannelz instance(); void addServer(InternalInstrumented<ServerStats> server); void addSubchannel(InternalInstrumented<ChannelStats> subchannel); void addRootChannel(InternalInstrumented<ChannelStats> rootChannel); void addClientSocket(InternalInstrumented<SocketStats> socket); void addListenSocket(InternalInstrumented<SocketStats> socket); void addServerSocket(
      InternalInstrumented<ServerStats> server, InternalInstrumented<SocketStats> socket); void removeServer(InternalInstrumented<ServerStats> server); void removeSubchannel(InternalInstrumented<ChannelStats> subchannel); void removeRootChannel(InternalInstrumented<ChannelStats> channel); void removeClientSocket(InternalInstrumented<SocketStats> socket); void removeListenSocket(InternalInstrumented<SocketStats> socket); void removeServerSocket(
      InternalInstrumented<ServerStats> server, InternalInstrumented<SocketStats> socket); RootChannelList getRootChannels(long fromId, int maxPageSize); @Nullable InternalInstrumented<ChannelStats> getChannel(long id); @Nullable InternalInstrumented<ChannelStats> getSubchannel(long id); ServerList getServers(long fromId, int maxPageSize); @Nullable ServerSocketsList getServerSockets(long serverId, long fromId, int maxPageSize); @Nullable InternalInstrumented<SocketStats> getSocket(long id); @VisibleForTesting boolean containsServer(InternalLogId serverRef); @VisibleForTesting boolean containsSubchannel(InternalLogId subchannelRef); InternalInstrumented<ChannelStats> getRootChannel(long id); @VisibleForTesting boolean containsClientSocket(InternalLogId transportRef); static long id(InternalWithLogId withLogId);  }