/** Expert: Make multiple, parallel calls to a set of servers. */ public static Object[] call( Method method, Object[][] params, InetSocketAddress[] addrs, UserGroupInformation ticket, Configuration conf) throws IOException { Invocation[] invocations = new Invocation[params.length]; for (int i = 0; i < params.length; i++) invocations[i] = new Invocation(method, params[i]); Client client = CLIENTS.getClient(conf); try { Writable[] wrappedValues = client.call(invocations, addrs, method.getDeclaringClass(), ticket); if (method.getReturnType() == Void.TYPE) { return null; } Object[] values = (Object[]) Array.newInstance(method.getReturnType(), wrappedValues.length); for (int i = 0; i < values.length; i++) if (wrappedValues[i] != null) values[i] = ((ObjectWritable) wrappedValues[i]).get(); return values; } finally { CLIENTS.stopClient(client); } }
public Invoker( Class<?> protocol, InetSocketAddress address, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout) throws IOException { this.remoteId = Client.ConnectionId.getConnectionId(address, protocol, ticket, rpcTimeout, conf); this.client = CLIENTS.getClient(conf, factory); }
public Invoker( InetSocketAddress address, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout, Class<?> protocol) { this.address = address; this.ticket = ticket; this.client = CLIENTS.getClient(conf, factory); this.rpcTimeout = rpcTimeout; this.protocol = protocol; }
static Client getClient(Configuration conf, SocketFactory socketFactory) { return CLIENTS.getClient(conf, socketFactory); }
/* close the IPC client that's responsible for this invoker's RPCs */ private synchronized void close() { if (!isClosed) { isClosed = true; CLIENTS.stopClient(client); } }
// for unit testing only @InterfaceAudience.Private @InterfaceStability.Unstable static Client getClient(Configuration conf) { return CLIENTS.getClient(conf); }