Exemple #1
0
  /** 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);
 }
Exemple #3
0
 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;
 }
 /* close the IPC client that's responsible for this invoker's RPCs */
 private synchronized void close() {
   if (!this.isClosed) {
     this.isClosed = true;
     CLIENTS.stopClient(this.client);
   }
 }
 public Invoker(InetSocketAddress address, SocketFactory factory) {
   this.address = address;
   this.client = CLIENTS.getClient(factory);
 }
 @Override
 public void afterRun(TestCaseRunner testRunner, TestCaseRunContext runContext) {
   ClientCache.getCache(runContext).assureFinalized();
 }
Exemple #7
0
 static Client getClient(Configuration conf, SocketFactory socketFactory) {
   return CLIENTS.getClient(conf, socketFactory);
 }
Exemple #8
0
 /* 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);
 }