Package org.apache.hadoop.hbase.ipc

Examples of org.apache.hadoop.hbase.ipc.RandomTimeoutRpcEngine$RandomTimeoutInvocationHandler


    long lastLimit = HConstants.DEFAULT_HBASE_CLIENT_PREFETCH_LIMIT;
    HConnection lastConnection = null;
    boolean lastFailed = false;
    int initialInvocations = RandomTimeoutRpcEngine.getNumberOfInvocations();

    RandomTimeoutRpcEngine engine = new RandomTimeoutRpcEngine(TEST_UTIL.getConfiguration());
    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.setLong(HConstants.HBASE_CLIENT_PREFETCH_LIMIT, ++lastLimit);
        try {
          HBaseAdmin admin = new HBaseAdmin(conf);
          HConnection connection = admin.getConnection();
          assertFalse(connection == lastConnection);
          lastConnection = connection;
          // override the connection's rpc engine for timeout testing
          ((HConnectionManager.HConnectionImplementation)connection).setRpcEngine(engine);
          // run some admin commands
          HBaseAdmin.checkHBaseAvailable(conf);
          admin.setBalancerRunning(false, false);
        } catch (MasterNotRunningException ex) {
          // Since we are randomly throwing SocketTimeoutExceptions, it is possible to get
          // a MasterNotRunningException.  It's a bug if we get other exceptions.
          lastFailed = true;
        }
      }
      // Ensure the RandomTimeoutRpcEngine is actually being used.
      assertFalse(lastFailed);
      assertTrue(RandomTimeoutRpcEngine.getNumberOfInvocations() > initialInvocations);
    } finally {
      engine.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.ipc.RandomTimeoutRpcEngine$RandomTimeoutInvocationHandler

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.