use of org.tron.common.overlay.discover.NodeHandler in project java-tron by tronprotocol.
the class SyncPool method logActivePeers.
synchronized void logActivePeers() {
logger.info("-------- active node.");
for (NodeHandler nodeHandler : nodeManager.getActiveNodes()) {
logger.info(nodeHandler.toString());
}
logger.info("-------- active channel {}, node in user size {}", channelManager.getActivePeers().size(), channelManager.nodesInUse().size());
for (Channel channel : channelManager.getActivePeers()) {
logger.info(channel.toString());
}
if (logger.isInfoEnabled()) {
StringBuilder sb = new StringBuilder("Peer stats:\n");
sb.append("Active peers\n");
sb.append("============\n");
Set<Node> activeSet = new HashSet<>();
for (PeerConnection peer : new ArrayList<>(activePeers)) {
sb.append(peer.logSyncStats()).append('\n');
activeSet.add(peer.getNode());
}
sb.append("Other connected peers\n");
sb.append("============\n");
for (Channel peer : new ArrayList<>(channelManager.getActivePeers())) {
if (!activeSet.contains(peer.getNode())) {
sb.append(peer.logSyncStats()).append('\n');
}
}
logger.info(sb.toString());
}
}
Aggregations