@Override public long getProtocolVersion(String protocol, long clientVersion) throws IOException { return RPC.getProtocolVersion(ZKFCProtocolPB.class); }
@Override public long getProtocolVersion(String protocol, long clientVersion) throws IOException { return RPC.getProtocolVersion(HAServiceProtocolPB.class); }
@Override public boolean isMethodSupported(String methodName) throws IOException { return RpcClientUtil.isMethodSupported(rpcProxy, GenericRefreshProtocolPB.class, RPC.RpcKind.RPC_PROTOCOL_BUFFER, RPC.getProtocolVersion(GenericRefreshProtocolPB.class), methodName); } }
@Override public boolean isMethodSupported(String methodName) throws IOException { return RpcClientUtil.isMethodSupported(rpcProxy, RefreshAuthorizationPolicyProtocolPB.class, RPC.RpcKind.RPC_PROTOCOL_BUFFER, RPC.getProtocolVersion(RefreshAuthorizationPolicyProtocolPB.class), methodName); } }
@Override public boolean isMethodSupported(String methodName) throws IOException { return RpcClientUtil.isMethodSupported(rpcProxy, GetUserMappingsProtocolPB.class, RPC.RpcKind.RPC_PROTOCOL_BUFFER, RPC.getProtocolVersion(GetUserMappingsProtocolPB.class), methodName); } }
@Override public boolean isMethodSupported(String methodName) throws IOException { return RpcClientUtil.isMethodSupported(rpcProxy, RefreshCallQueueProtocolPB.class, RPC.RpcKind.RPC_PROTOCOL_BUFFER, RPC.getProtocolVersion(RefreshCallQueueProtocolPB.class), methodName); } }
@Override public boolean isMethodSupported(String methodName) throws IOException { return RpcClientUtil .isMethodSupported(rpcProxy, RefreshUserMappingsProtocolPB.class, RPC.RpcKind.RPC_PROTOCOL_BUFFER, RPC.getProtocolVersion(RefreshUserMappingsProtocolPB.class), methodName); } }
public Invocation(Method method, Object[] parameters) { this.methodName = method.getName(); this.parameterClasses = method.getParameterTypes(); this.parameters = parameters; rpcVersion = writableRpcVersion; if (method.getDeclaringClass().equals(VersionedProtocol.class)) { //VersionedProtocol is exempted from version check. clientVersion = 0; clientMethodsHash = 0; } else { this.clientVersion = RPC.getProtocolVersion(method.getDeclaringClass()); this.clientMethodsHash = ProtocolSignature.getFingerprint(method .getDeclaringClass().getMethods()); } this.declaringClassProtocolName = RPC.getProtocolName(method.getDeclaringClass()); }
public ZKFCProtocolClientSideTranslatorPB( InetSocketAddress addr, Configuration conf, SocketFactory socketFactory, int timeout) throws IOException { RPC.setProtocolEngine(conf, ZKFCProtocolPB.class, ProtobufRpcEngine.class); rpcProxy = RPC.getProxy(ZKFCProtocolPB.class, RPC.getProtocolVersion(ZKFCProtocolPB.class), addr, UserGroupInformation.getCurrentUser(), conf, socketFactory, timeout); }
public HAServiceProtocolClientSideTranslatorPB( InetSocketAddress addr, Configuration conf, SocketFactory socketFactory, int timeout) throws IOException { RPC.setProtocolEngine(conf, HAServiceProtocolPB.class, ProtobufRpcEngine.class); rpcProxy = RPC.getProxy(HAServiceProtocolPB.class, RPC.getProtocolVersion(HAServiceProtocolPB.class), addr, UserGroupInformation.getCurrentUser(), conf, socketFactory, timeout); }
/** * This constructor takes a connectionId, instead of creating a new one. */ private Invoker(Class<?> protocol, Client.ConnectionId connId, Configuration conf, SocketFactory factory) { this.remoteId = connId; this.client = CLIENTS.getClient(conf, factory, RpcWritable.Buffer.class); this.protocolName = RPC.getProtocolName(protocol); this.clientProtocolVersion = RPC .getProtocolVersion(protocol); }
@Override public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException { if (!protocol.equals(RPC.getProtocolName(ZKFCProtocolPB.class))) { throw new IOException("Serverside implements " + RPC.getProtocolName(ZKFCProtocolPB.class) + ". The following requested protocol is unknown: " + protocol); } return ProtocolSignature.getProtocolSignature(clientMethodsHash, RPC.getProtocolVersion(ZKFCProtocolPB.class), HAServiceProtocolPB.class); }
public HAServiceProtocolClientSideTranslatorPB(InetSocketAddress addr, Configuration conf) throws IOException { RPC.setProtocolEngine(conf, HAServiceProtocolPB.class, ProtobufRpcEngine.class); rpcProxy = RPC.getProxy(HAServiceProtocolPB.class, RPC.getProtocolVersion(HAServiceProtocolPB.class), addr, conf); }
@Override public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException { if (!protocol.equals(RPC.getProtocolName(TraceAdminProtocolPB.class))) { throw new IOException("Serverside implements " + RPC.getProtocolName(TraceAdminProtocolPB.class) + ". The following requested protocol is unknown: " + protocol); } return ProtocolSignature.getProtocolSignature(clientMethodsHash, RPC.getProtocolVersion(TraceAdminProtocolPB.class), TraceAdminProtocolPB.class); } }
@Override public ProtocolSignature getProtocolSignature(String protocol, long clientVersion, int clientMethodsHash) throws IOException { if (!protocol.equals(RPC.getProtocolName(HAServiceProtocolPB.class))) { throw new IOException("Serverside implements " + RPC.getProtocolName(HAServiceProtocolPB.class) + ". The following requested protocol is unknown: " + protocol); } return ProtocolSignature.getProtocolSignature(clientMethodsHash, RPC.getProtocolVersion(HAServiceProtocolPB.class), HAServiceProtocolPB.class); } }
void registerProtocolAndImpl(RpcKind rpcKind, Class<?> protocolClass, Object protocolImpl) { String protocolName = RPC.getProtocolName(protocolClass); long version; try { version = RPC.getProtocolVersion(protocolClass); } catch (Exception ex) { LOG.warn("Protocol " + protocolClass + " NOT registered as cannot get protocol version "); return; } getProtocolImplMap(rpcKind).put(new ProtoNameVer(protocolName, version), new ProtoClassProtoImpl(protocolClass, protocolImpl)); if (LOG.isDebugEnabled()) { LOG.debug("RpcKind = " + rpcKind + " Protocol Name = " + protocolName + " version=" + version + " ProtocolImpl=" + protocolImpl.getClass().getName() + " protocolClass=" + protocolClass.getName()); } }
private void fetchServerMethods(Method method) throws IOException { long clientVersion; clientVersion = RPC.getProtocolVersion(method.getDeclaringClass()); int clientMethodsHash = ProtocolSignature.getFingerprint(method .getDeclaringClass().getMethods()); ProtocolSignature serverInfo = ((VersionedProtocol) proxy) .getProtocolSignature(RPC.getProtocolName(protocol), clientVersion, clientMethodsHash); long serverVersion = serverInfo.getVersion(); if (serverVersion != clientVersion) { throw new RPC.VersionMismatch(protocol.getName(), clientVersion, serverVersion); } int[] serverMethodsCodes = serverInfo.getMethods(); if (serverMethodsCodes != null) { serverMethods = new HashSet<Integer>(serverMethodsCodes.length); for (int m : serverMethodsCodes) { this.serverMethods.add(Integer.valueOf(m)); } } serverMethodsFetched = true; }
Class<?> xface = TraceAdminProtocolPB.class; proxy = (TraceAdminProtocolPB)RPC.getProxy(xface, RPC.getProtocolVersion(xface), address, ugi, getConf(), NetUtils.getDefaultSocketFactory(getConf()), 0); remote = new TraceAdminProtocolTranslatorPB(proxy);
public boolean isMethodSupported(String methodName) throws IOException { return RpcClientUtil.isMethodSupported(rpcProxy, QJournalProtocolPB.class, RPC.RpcKind.RPC_PROTOCOL_BUFFER, RPC.getProtocolVersion(QJournalProtocolPB.class), methodName); }
private static DatanodeLifelineProtocolPB createNamenode( InetSocketAddress nameNodeAddr, Configuration conf, UserGroupInformation ugi) throws IOException { return RPC.getProxy(DatanodeLifelineProtocolPB.class, RPC.getProtocolVersion(DatanodeLifelineProtocolPB.class), nameNodeAddr, ugi, conf, NetUtils.getSocketFactory(conf, DatanodeLifelineProtocolPB.class)); }