/** * Make a call, passing <code>rpcRequest</code>, to the IPC server defined by * <code>remoteId</code>, returning the rpc respond. * * @param rpcKind * @param rpcRequest - contains serialized method and method parameters * @param remoteId - the target rpc server * @param fallbackToSimpleAuth - set to true or false during this method to * indicate if a secure client falls back to simple auth * @returns the rpc response * Throws exceptions if there are network problems or if the remote code * threw an exception. */ public Writable call(RPC.RpcKind rpcKind, Writable rpcRequest, ConnectionId remoteId, AtomicBoolean fallbackToSimpleAuth) throws IOException { return call(rpcKind, rpcRequest, remoteId, RPC.RPC_SERVICE_CLASS_DEFAULT, fallbackToSimpleAuth); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { long startTime = 0; if (LOG.isDebugEnabled()) { startTime = Time.monotonicNow(); } // if Tracing is on then start a new span for this rpc. // guard it in the if statement to make sure there isn't // any extra string manipulation. Tracer tracer = Tracer.curThreadTracer(); TraceScope traceScope = null; if (tracer != null) { traceScope = tracer.newScope(RpcClientUtil.methodToTraceString(method)); } ObjectWritable value; try { value = (ObjectWritable) client.call(RPC.RpcKind.RPC_WRITABLE, new Invocation(method, args), remoteId, fallbackToSimpleAuth); } finally { if (traceScope != null) traceScope.close(); } if (LOG.isDebugEnabled()) { long callTime = Time.monotonicNow() - startTime; LOG.debug("Call: " + method.getName() + " " + callTime); } return value.get(); }
final RpcWritable.Buffer val; try { val = (RpcWritable.Buffer) client.call(RPC.RpcKind.RPC_PROTOCOL_BUFFER, new RpcProtobufRequest(rpcRequestHeader, theRequest), remoteId, fallbackToSimpleAuth);
/** * Same as {@link #call(RPC.RpcKind, Writable, ConnectionId)} * for RPC_BUILTIN */ public Writable call(Writable param, InetSocketAddress address) throws IOException { return call(RPC.RpcKind.RPC_BUILTIN, param, address); } /** Make a call, passing <code>param</code>, to the IPC server running at
/** * Same as {@link #call(RPC.RpcKind, Writable, ConnectionId)} * for RPC_BUILTIN */ public Writable call(Writable param, InetSocketAddress address) throws IOException { return call(RPC.RpcKind.RPC_BUILTIN, param, address); } /** Make a call, passing <code>param</code>, to the IPC server running at
/** * Same as {link {@link #call(RPC.RpcKind, Writable, ConnectionId)} * except the rpcKind is RPC_BUILTIN */ public Writable call(Writable param, ConnectionId remoteId) throws IOException { return call(RPC.RpcKind.RPC_BUILTIN, param, remoteId); }
/** * Same as {link {@link #call(RPC.RpcKind, Writable, ConnectionId)} * except the rpcKind is RPC_BUILTIN */ public Writable call(Writable param, ConnectionId remoteId) throws IOException { return call(RPC.RpcKind.RPC_BUILTIN, param, remoteId); }
/** * Same as {link {@link #call(RPC.RpcKind, Writable, ConnectionId)} * except the rpcKind is RPC_BUILTIN */ public Writable call(Writable param, ConnectionId remoteId) throws IOException { return call(RPC.RpcKind.RPC_BUILTIN, param, remoteId); }
/** Make a call, passing <code>param</code>, to the IPC server running at * <code>address</code>, returning the value. Throws exceptions if there are * network problems or if the remote code threw an exception. * @deprecated Use {@link #call(RPC.RpcKind, Writable, * ConnectionId)} instead */ @Deprecated public Writable call(RPC.RpcKind rpcKind, Writable param, InetSocketAddress address) throws IOException { return call(rpcKind, param, address, null); }
/** Make a call, passing <code>param</code>, to the IPC server running at * <code>address</code>, returning the value. Throws exceptions if there are * network problems or if the remote code threw an exception. * @deprecated Use {@link #call(RPC.RpcKind, Writable, * ConnectionId)} instead */ @Deprecated public Writable call(RPC.RpcKind rpcKind, Writable param, InetSocketAddress address) throws IOException { return call(rpcKind, param, address, null); }
/** Make a call, passing <code>param</code>, to the IPC server running at * <code>address</code>, returning the value. Throws exceptions if there are * network problems or if the remote code threw an exception. * @deprecated Use {@link #call(Writable, InetSocketAddress, Class, UserGroupInformation)} instead */ @Deprecated public Writable call(Writable param, InetSocketAddress address) throws InterruptedException, IOException { return call(param, address, null); }
/** * Makes a set of calls in parallel. Each parameter is sent to the * corresponding address. When all values are available, or have timed out * or errored, the collected results are returned in an array. The array * contains nulls for calls that timed out or errored. * @deprecated Use {@link #call(Writable[], InetSocketAddress[], Class, UserGroupInformation)} instead */ @Deprecated public Writable[] call(Writable[] params, InetSocketAddress[] addresses) throws IOException { return call(params, addresses, null, null); }
/** Make a call, passing <code>param</code>, to the IPC server running at * <code>address</code>, returning the value. Throws exceptions if there are * network problems or if the remote code threw an exception. * @deprecated Use {@link #call(RPC.RpcKind, Writable, * ConnectionId)} instead */ @Deprecated public Writable call(RPC.RpcKind rpcKind, Writable param, InetSocketAddress address) throws IOException { return call(rpcKind, param, address, null); }
/** * Same as {@link #call(RPC.RpcKind, Writable, InetSocketAddress, * Class, UserGroupInformation, int, Configuration)} * except that rpcKind is writable. */ public Writable call(Writable param, InetSocketAddress addr, Class<?> protocol, UserGroupInformation ticket, int rpcTimeout, Configuration conf) throws IOException { ConnectionId remoteId = ConnectionId.getConnectionId(addr, protocol, ticket, rpcTimeout, conf); return call(RPC.RpcKind.RPC_BUILTIN, param, remoteId); }
/** * Same as {@link #call(RPC.RpcKind, Writable, InetSocketAddress, * Class, UserGroupInformation, int, Configuration)} * except that rpcKind is writable. */ public Writable call(Writable param, InetSocketAddress addr, Class<?> protocol, UserGroupInformation ticket, int rpcTimeout, Configuration conf) throws IOException { ConnectionId remoteId = ConnectionId.getConnectionId(addr, protocol, ticket, rpcTimeout, conf); return call(RPC.RpcKind.RPC_BUILTIN, param, remoteId); }
/** * Same as {@link #call(RPC.RpcKind, Writable, InetSocketAddress, * Class, UserGroupInformation, int, Configuration)} * except that rpcKind is writable. */ public Writable call(Writable param, InetSocketAddress addr, Class<?> protocol, UserGroupInformation ticket, int rpcTimeout, Configuration conf) throws IOException { ConnectionId remoteId = ConnectionId.getConnectionId(addr, protocol, ticket, rpcTimeout, conf); return call(RPC.RpcKind.RPC_BUILTIN, param, remoteId); }
@Override public Integer call() throws IOException { return ((IntWritable)client.call(wait2, address)).get(); } });
@Override public Integer call() throws IOException { return ((IntWritable)client.call(wait1, address)).get(); } });
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { LongWritable param = new LongWritable(RANDOM.nextLong()); LongWritable value = (LongWritable) client.call(param, NetUtils.getConnectAddress(server), null, null, 0, conf); if (retry++ < total) { throw new IOException("Fake IOException"); } else { return value; } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { LongWritable param = new LongWritable(RANDOM.nextLong()); LongWritable value = (LongWritable) client.call(param, NetUtils.getConnectAddress(server), null, null, 0, conf); if (retry++ < total) { throw new IOException("Fake IOException"); } else { return value; } }