public int getProtocolId() { return protocolVersionId.getProtocolId(); }
public int getProtocolVersion() { return protocolVersionId.getVersion(); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + accessPointId; result = prime * result + Arrays.hashCode(connectionData); result = prime * result + ((protocolVersionId == null) ? 0 : protocolVersionId.hashCode()); return result; }
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; }
private static List<ProtocolVersionId> convert(List<ProtocolVersionPair> supportedProtocols) { if (supportedProtocols == null) { return Collections.emptyList(); } List<ProtocolVersionId> result = new ArrayList<ProtocolVersionId>(supportedProtocols.size()); for (ProtocolVersionPair pair : supportedProtocols) { result.add(new ProtocolVersionId(pair.getId(), pair.getVersion())); } return result; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } ProtocolConnectionData other = (ProtocolConnectionData) obj; if (accessPointId != other.accessPointId) { return false; } if (!Arrays.equals(connectionData, other.connectionData)) { return false; } if (protocolVersionId == null) { if (other.protocolVersionId != null) { return false; } } else if (!protocolVersionId.equals(other.protocolVersionId)) { return false; } return true; }
private void parseBootstrapClientSync(ClientSync sync, ByteBuffer buf, int options, int payloadLength) { int requestId = buf.getShort(); int protocolCount = buf.getShort(); List<ProtocolVersionId> keys = new ArrayList<>(protocolCount); for (int i = 0; i < protocolCount; i++) { keys.add(new ProtocolVersionId(buf.getInt(), buf.getShort())); // reserved buf.getShort(); } sync.setBootstrapSync(new BootstrapClientSync(requestId, keys)); }
private Set<ProtocolConnectionData> toProtocolConnectionData(OperationsNodeInfo node, TransportMetaData md, int version) { byte[] connectionData = null; Set<ProtocolConnectionData> result = new HashSet<>(); for (VersionConnectionInfoPair pair : md.getConnectionInfo()) { if (version == pair.getVersion()) { result.add(new ProtocolConnectionData(ServerNameUtil.crc32(node.getConnectionInfo()), new ProtocolVersionId(md.getId(), version), pair.getConenctionInfo().array()) ); } } return result; }