protected Responder(Protocol local) { this.local = local; this.localHash = new MD5(); localHash.bytes(local.getMD5()); protocols.put(localHash, local); this.rpcMetaPlugins = new CopyOnWriteArrayList<>(); }
if (fieldOrder == null) { if (this.clientHash == null) { this.clientHash = new org.apache.avro.ipc.MD5(); this.serverHash = new org.apache.avro.ipc.MD5(); case 0: if (this.clientHash == null) { this.clientHash = new org.apache.avro.ipc.MD5(); this.serverHash = new org.apache.avro.ipc.MD5();
private void writeHandshake(Encoder out) throws IOException { if (getTransceiver().isConnected()) return; MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } else { remote = REMOTE_PROTOCOLS.get(remoteHash); } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = local.toString(); RPCContext context = new RPCContext(); context.setHandshakeRequest(handshake); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }
} else { if (this.serverHash == null) { this.serverHash = new org.apache.avro.ipc.MD5(); } else { if (this.serverHash == null) { this.serverHash = new org.apache.avro.ipc.MD5();
public void testRoundtripAvroWithHandShakeRequest() { String className = "java=org.apache.avro.ipc.HandshakeRequest"; HandshakeRequest req = new HandshakeRequest(); // set a few values to avoid NPEs req.clientHash = new MD5(); req.clientProtocol = new Utf8(""); req.serverHash = new MD5(); AvroSpecificSerializer<HandshakeRequest> serializer = new AvroSpecificSerializer<HandshakeRequest>(className); byte[] bytes = serializer.toBytes(req); byte[] bytes2 = serializer.toBytes(req); assertEquals(ByteUtils.compare(bytes, bytes2), 0); assertTrue(serializer.toObject(bytes).equals(req)); assertTrue(serializer.toObject(bytes2).equals(req)); } }
protected Responder(Protocol local) { this.local = local; this.localHash = new MD5(); localHash.bytes(local.getMD5()); protocols.put(localHash, local); this.rpcMetaPlugins = Collections.synchronizedList(new ArrayList<RPCPlugin>()); }
protected Responder(Protocol local) { this.local = local; this.localHash = new MD5(); localHash.bytes(local.getMD5()); protocols.put(localHash, local); this.rpcMetaPlugins = Collections.synchronizedList(new ArrayList<RPCPlugin>()); }
protected Responder(Protocol local) { this.local = local; this.localHash = new MD5(); localHash.bytes(local.getMD5()); protocols.put(localHash, local); this.rpcMetaPlugins = new CopyOnWriteArrayList<RPCPlugin>(); }
private void writeHandshake(Encoder out) throws IOException { MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); remote = REMOTE_PROTOCOLS.get(remoteHash); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = new Utf8(local.toString()); RPCContext context = new RPCContext(); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }
private void writeHandshake(Encoder out) throws IOException { if (getTransceiver().isConnected()) return; MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); remote = REMOTE_PROTOCOLS.get(remoteHash); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = new Utf8(local.toString()); RPCContext context = new RPCContext(); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }
private void writeHandshake(Encoder out) throws IOException { if (getTransceiver().isConnected()) return; MD5 localHash = new MD5(); localHash.bytes(local.getMD5()); String remoteName = transceiver.getRemoteName(); MD5 remoteHash = REMOTE_HASHES.get(remoteName); if (remoteHash == null) { // guess remote is local remoteHash = localHash; remote = local; } else { remote = REMOTE_PROTOCOLS.get(remoteHash); } HandshakeRequest handshake = new HandshakeRequest(); handshake.clientHash = localHash; handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = local.toString(); RPCContext context = new RPCContext(); context.setHandshakeRequest(handshake); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); HANDSHAKE_WRITER.write(handshake, out); }