/** * Use when one need to write an OperationsNodeInfo instance to logs. The OperationsNodeInfo * instance has ByteBuffer fields which should be represented in log files as null because their * values are unrepresentative and redundant. * * @param format the format string * @param node the instance of OperationsNodeInfo * @param resolver the instance of OperationsServerResolver */ private void writeLogWithoutByteBuffer(String format, OperationsNodeInfo node, OperationsServerResolver resolver) { // Temporary remove connection info for transports Map<TransportMetaData, Map<VersionConnectionInfoPair, ByteBuffer>> transportMetaData = new HashMap<>(); node.getTransports().forEach(transport -> transportMetaData.put(transport, removeTransportConnectionInfo(transport))); // Temporary remove public key final ByteBuffer publicKey = node.getConnectionInfo().getPublicKey(); node.getConnectionInfo().setPublicKey(null); LOG.info(format, node, resolver); // Restore connection info for transports node.getTransports().forEach(transport -> restoreTransportConnectionInfo(transport, transportMetaData.get(transport))); // Restore public key node.getConnectionInfo().setPublicKey(publicKey); }
protected Set<ProtocolConnectionData> filterProtocolInstances(List<ProtocolVersionId> keys) { Set<ProtocolConnectionData> result = new HashSet<>(); for (ProtocolVersionId key : keys) { for (OperationsNodeInfo node : opsMap.values()) { for (TransportMetaData md : node.getTransports()) { if (md.getId() == key.getProtocolId() && md.getMinSupportedVersion() <= key.getVersion() && key.getVersion() <= md.getMaxSupportedVersion()) { result.addAll(toProtocolConnectionData(node, md, key.getVersion())); } } } } return result; }