Package org.apache.hadoop.hbase.ipc

Examples of org.apache.hadoop.hbase.ipc.ProtobufRpcClientEngine


    // Create the thread to clean the moved regions list
    movedRegionsCleaner = MovedRegionsCleaner.createAndStart(this);

    // Setup RPC client for master communication
    rpcClientEngine = new ProtobufRpcClientEngine(conf, clusterId);
  }
View Full Code Here


      retrieveClusterId();

      // ProtobufRpcClientEngine is the main RpcClientEngine implementation,
      // but we maintain access through an interface to allow overriding for tests
      // RPC engine setup must follow obtaining the cluster ID for token authentication to work
      this.rpcEngine = new ProtobufRpcClientEngine(this.conf, this.clusterId);


      // Do we publish the status?
      Class<? extends ClusterStatusListener.Listener> listenerClass =
          conf.getClass(ClusterStatusListener.STATUS_LISTENER_CLASS,
View Full Code Here

    HMaster hm = new HMaster(conf);

    ServerName sm = hm.getServerName();
    InetSocketAddress isa = new InetSocketAddress(sm.getHostname(), sm.getPort());
    ProtobufRpcClientEngine engine =
        new ProtobufRpcClientEngine(conf, HConstants.CLUSTER_ID_DEFAULT);
    try {
      int i = 0;
      //retry the RPC a few times; we have seen SocketTimeoutExceptions if we
      //try to connect too soon. Retry on SocketTimeoutException.
      while (i < 20) {
        try {
          MasterMonitorProtocol inf = engine.getProxy(
              MasterMonitorProtocol.class, isa, conf, 100 * 10);
          inf.isMasterRunning(null, IsMasterRunningRequest.getDefaultInstance());
          fail();
        } catch (ServiceException ex) {
          IOException ie = ProtobufUtil.getRemoteException(ex);
          if (!(ie instanceof SocketTimeoutException)) {
            if(ie.getMessage().startsWith(
                "org.apache.hadoop.hbase.exceptions.ServerNotRunningYetException: Server is not running yet")) {
              return;
            }
          } else {
            System.err.println("Got SocketTimeoutException. Will retry. ");
          }
        } catch (Throwable t) {
          fail("Unexpected throwable: " + t);
        }
        Thread.sleep(100);
        i++;
      }
      fail();
    } finally {
      engine.close();
    }
  }
View Full Code Here

    // verify the server authenticates us as this token user
    testuser.doAs(new PrivilegedExceptionAction<Object>() {
      public Object run() throws Exception {
        Configuration c = server.getConfiguration();
        ProtobufRpcClientEngine rpcClient =
            new ProtobufRpcClientEngine(c, clusterId.toString());
        try {
          AuthenticationProtos.AuthenticationService.BlockingInterface proxy =
              HBaseClientRPC.waitForProxy(rpcClient, BlockingAuthenticationService.class,
                  server.getAddress(), c,
                  HConstants.DEFAULT_HBASE_CLIENT_RPC_MAXATTEMPTS,
                  HConstants.DEFAULT_HBASE_RPC_TIMEOUT,
                  HConstants.DEFAULT_HBASE_RPC_TIMEOUT);

          AuthenticationProtos.WhoAmIResponse response =
              proxy.whoami(null, AuthenticationProtos.WhoAmIRequest.getDefaultInstance());
          String myname = response.getUsername();
          assertEquals("testuser", myname);
          String authMethod = response.getAuthMethod();
          assertEquals("TOKEN", authMethod);
        } finally {
          rpcClient.close();
        }
        return null;
      }
    });
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.ipc.ProtobufRpcClientEngine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.