Package org.apache.hadoop.hbase.ipc

Examples of org.apache.hadoop.hbase.ipc.RpcClient$BlockingRpcChannelImplementation


    });

    ServerName sn = table.getRegionLocation(ROW).getServerName();
    ConnectionManager.HConnectionImplementation conn =
        (ConnectionManager.HConnectionImplementation) table.getConnection();
    RpcClient rpcClient = conn.getRpcClient();

    LOG.info("Going to cancel connections. connection=" + conn.toString() + ", sn=" + sn);
    for (int i = 0; i < 5000; i++) {
      rpcClient.cancelConnections(sn.getHostname(), sn.getPort());
      Thread.sleep(5);
    }

    step.compareAndSet(1, 2);
    // The test may fail here if the thread doing the gets is stuck. The way to find
View Full Code Here


  @Test
  public void testAdminTimeout() throws Exception {
    HConnection lastConnection = null;
    boolean lastFailed = false;
    int initialInvocations = RandomTimeoutBlockingRpcChannel.invokations.get();
    RpcClient rpcClient = newRandomTimeoutRpcClient();
    try {
      for (int i = 0; i < 5 || (lastFailed && i < 100); ++i) {
        lastFailed = false;
        // Ensure the HBaseAdmin uses a new connection by changing Configuration.
        Configuration conf = HBaseConfiguration.create(TEST_UTIL.getConfiguration());
        conf.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
        HBaseAdmin admin = null;
        try {
          admin = new HBaseAdmin(conf);
          HConnection connection = admin.getConnection();
          assertFalse(connection == lastConnection);
          lastConnection = connection;
          // Override the connection's rpc client for timeout testing
          RpcClient oldRpcClient =
            ((ConnectionManager.HConnectionImplementation)connection).setRpcClient(
              rpcClient);
          if (oldRpcClient != null) {
            oldRpcClient.stop();
          }
          // run some admin commands
          HBaseAdmin.checkHBaseAvailable(conf);
          admin.setBalancerRunning(false, false);
        } catch (MasterNotRunningException ex) {
View Full Code Here

      rpcClient.stop();
    }
  }

  private static RpcClient newRandomTimeoutRpcClient() {
    return new RpcClient(
        TEST_UTIL.getConfiguration(), TEST_UTIL.getClusterKey()) {
      // Return my own instance, one that does random timeouts
      @Override
      public BlockingRpcChannel createBlockingRpcChannel(ServerName sn,
          User ticket, int rpcTimeout) {
View Full Code Here

      this.batchPool = pool;
      this.managed = managed;
      this.registry = setupRegistry();
      retrieveClusterId();

      this.rpcClient = new RpcClient(this.conf, this.clusterId);

      // Do we publish the status?
      boolean shouldListen = conf.getBoolean(HConstants.STATUS_PUBLISHED,
          HConstants.STATUS_PUBLISHED_DEFAULT);
      Class<? extends ClusterStatusListener.Listener> listenerClass =
View Full Code Here

     * For tests only.
     * @param rpcClient Client we should use instead.
     * @return Previous rpcClient
     */
    RpcClient setRpcClient(final RpcClient rpcClient) {
      RpcClient oldRpcClient = this.rpcClient;
      this.rpcClient = rpcClient;
      return oldRpcClient;
    }
View Full Code Here

      // Create the chore that cleans up nonces.
      nonceManagerChore = this.nonceManager.createCleanupChore(this);
    }

    // Setup RPC client for master communication
    rpcClient = new RpcClient(conf, clusterId, new InetSocketAddress(
        this.isa.getAddress(), 0));
    this.pauseMonitor = new JvmPauseMonitor(conf);
    pauseMonitor.start();
  }
View Full Code Here

    });

    ServerName sn = table.getRegionLocation(ROW).getServerName();
    ConnectionManager.HConnectionImplementation conn =
        (ConnectionManager.HConnectionImplementation) table.getConnection();
    RpcClient rpcClient = conn.getRpcClient();

    LOG.info("Going to cancel connections. connection=" + conn.toString() + ", sn=" + sn);
    for (int i = 0; i < 5000; i++) {
      rpcClient.cancelConnections(sn.getHostname(), sn.getPort());
      Thread.sleep(5);
    }

    step.compareAndSet(1, 2);
    // The test may fail here if the thread doing the gets is stuck. The way to find
View Full Code Here

     * @param rpcClient Client we should use instead.
     * @return Previous rpcClient
     */
    @VisibleForTesting
    RpcClient setRpcClient(final RpcClient rpcClient) {
      RpcClient oldRpcClient = this.rpcClient;
      this.rpcClient = rpcClient;
      return oldRpcClient;
    }
View Full Code Here

      this.batchPool = pool;
      this.managed = managed;
      this.registry = setupRegistry();
      retrieveClusterId();

      this.rpcClient = new RpcClient(this.conf, this.clusterId);
      this.rpcControllerFactory = RpcControllerFactory.instantiate(conf);

      // Do we publish the status?
      boolean shouldListen = conf.getBoolean(HConstants.STATUS_PUBLISHED,
          HConstants.STATUS_PUBLISHED_DEFAULT);
View Full Code Here

  @Test
  public void testAdminTimeout() throws Exception {
    Connection lastConnection = null;
    boolean lastFailed = false;
    int initialInvocations = RandomTimeoutBlockingRpcChannel.invokations.get();
    RpcClient rpcClient = newRandomTimeoutRpcClient();
    try {
      for (int i = 0; i < 5 || (lastFailed && i < 100); ++i) {
        lastFailed = false;
        // Ensure the HBaseAdmin uses a new connection by changing Configuration.
        Configuration conf = HBaseConfiguration.create(TEST_UTIL.getConfiguration());
        conf.set(HConstants.HBASE_CLIENT_INSTANCE_ID, String.valueOf(-1));
        HBaseAdmin admin = null;
        try {
          admin = new HBaseAdmin(conf);
          Connection connection = admin.getConnection();
          assertFalse(connection == lastConnection);
          lastConnection = connection;
          // Override the connection's rpc client for timeout testing
          RpcClient oldRpcClient =
            ((ConnectionManager.HConnectionImplementation)connection).setRpcClient(
              rpcClient);
          if (oldRpcClient != null) {
            oldRpcClient.stop();
          }
          // run some admin commands
          HBaseAdmin.checkHBaseAvailable(conf);
          admin.setBalancerRunning(false, false);
        } catch (MasterNotRunningException ex) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.ipc.RpcClient$BlockingRpcChannelImplementation

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.