### Question:
AsyncProcess { protected ConnectionManager.ServerErrorTracker createServerErrorTracker() { return new ConnectionManager.ServerErrorTracker( this.serverTrackerTimeout, this.numTries); } AsyncProcess(ClusterConnection hc, Configuration conf, ExecutorService pool,
      RpcRetryingCallerFactory rpcCaller, boolean useGlobalErrors, RpcControllerFactory rpcFactory); AsyncRequestFuture submit(TableName tableName, List<? extends Row> rows,
      boolean atLeastOne, Batch.Callback<CResult> callback, boolean needResults); AsyncRequestFuture submit(ExecutorService pool, TableName tableName,
      List<? extends Row> rows, boolean atLeastOne, Batch.Callback<CResult> callback,
      boolean needResults); AsyncRequestFuture submitAll(TableName tableName,
      List<? extends Row> rows, Batch.Callback<CResult> callback, Object[] results); AsyncRequestFuture submitAll(ExecutorService pool, TableName tableName,
      List<? extends Row> rows, Batch.Callback<CResult> callback, Object[] results); boolean hasError(); RetriesExhaustedWithDetailsException waitForAllPreviousOpsAndReset(
      List<Row> failedRows);  }### Answer:
@Test public void testErrorsServers() throws IOException { HTable ht = new HTable(); Configuration configuration = new Configuration(conf); configuration.setBoolean(ConnectionManager.RETRIES_BY_SERVER_KEY, true); configuration.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 3); ht.setWriteBufferSize(configuration.getLong("hbase.client.write.buffer", 2097152)); ht.connection = new MyConnectionImpl(configuration); MyAsyncProcess ap = new MyAsyncProcess(ht.connection, conf, true); ht.ap = ap; Assert.assertNotNull(ht.ap.createServerErrorTracker()); Assert.assertTrue(ht.ap.serverTrackerTimeout > 200); ht.ap.serverTrackerTimeout = 1; Put p = createPut(1, false); ht.setAutoFlush(false, false); ht.put(p); try { ht.flushCommits(); Assert.fail(); } catch (RetriesExhaustedWithDetailsException expected) { } Assert.assertEquals(2, ap.getRetriesRequested()); }
@Test public void testErrorsServers() throws IOException { HTable ht = new HTable(); Configuration configuration = new Configuration(conf); configuration.setBoolean(ConnectionManager.RETRIES_BY_SERVER_KEY, true); ht.setWriteBufferSize(configuration.getLong("hbase.client.write.buffer", 2097152)); ht.connection = new MyConnectionImpl(configuration); MyAsyncProcess ap = new MyAsyncProcess(ht.connection, configuration, true); ht.ap = ap; Assert.assertNotNull(ht.ap.createServerErrorTracker()); Assert.assertTrue(ht.ap.serverTrackerTimeout > 200); ht.ap.serverTrackerTimeout = 1; Put p = createPut(1, false); ht.setAutoFlush(false, false); ht.put(p); try { ht.flushCommits(); Assert.fail(); } catch (RetriesExhaustedWithDetailsException expected) { } Assert.assertEquals(NB_RETRIES + 1, ap.callsCt.get()); }
@Test public void testGlobalErrors() throws IOException { HTable ht = new HTable(); ht.connection = new MyConnectionImpl(conf); AsyncProcessWithFailure ap = new AsyncProcessWithFailure(ht.connection, conf); ht.ap = ap; Assert.assertNotNull(ht.ap.createServerErrorTracker()); Put p = createPut(1, true); ht.setAutoFlush(false, false); ht.put(p); try { ht.flushCommits(); Assert.fail(); } catch (RetriesExhaustedWithDetailsException expected) { } Assert.assertEquals(NB_RETRIES + 1, ap.callsCt.get()); }