@Override
  public int run(String[] args) throws Exception {
    if (args.length < 1 || args.length > 2) {
      System.out.println("Usage: " + this.getClass().getName() + " tableName [num_operations]");
      return -1;
    }
    TableName tableName = TableName.valueOf(args[0]);
    int numOps = args.length > 1 ? Integer.parseInt(args[1]) : DEFAULT_NUM_OPS;
    ExecutorService threadPool = Executors.newFixedThreadPool(THREAD_POOL_SIZE,
      new ThreadFactoryBuilder().setNameFormat("AsyncClientExample-pool-%d").setDaemon(true)
        .setUncaughtExceptionHandler(Threads.LOGGING_EXCEPTION_HANDLER).build());
    // We use AsyncTable here so we need to provide a separated thread pool. RawAsyncTable does not
    // need a thread pool and may have a better performance if you use it correctly as it can save
    // some context switches. But if you use RawAsyncTable incorrectly, you may have a very bad
    // impact on performance so use it with caution.
    CountDownLatch latch = new CountDownLatch(numOps);
    IntStream.range(0, numOps).forEach(i -> {
      CompletableFuture<AsyncConnection> future = getConn();
      addListener(future, (conn, error) -> {
        if (error != null) {
          LOG.warn("failed to get async connection for " + i, error);
          latch.countDown();
          return;
        }
        AsyncTable<?> table = conn.getTable(tableName, threadPool);
        addListener(table.put(new Put(getKey(i)).addColumn(FAMILY, QUAL, Bytes.toBytes(i))),
          (putResp, putErr) -> {
            if (putErr != null) {
              LOG.warn("put failed for " + i, putErr);
              latch.countDown();
              return;
            }
            LOG.info("put for " + i + " succeeded, try getting");
            addListener(table.get(new Get(getKey(i))), (result, getErr) -> {
              if (getErr != null) {
                LOG.warn("get failed for " + i);
                latch.countDown();
                return;
              }
              if (result.isEmpty()) {
                LOG.warn("get failed for " + i + ", server returns empty result");
              } else if (!result.containsColumn(FAMILY, QUAL)) {
                LOG.warn("get failed for " + i + ", the result does not contain "
                  + Bytes.toString(FAMILY) + ":" + Bytes.toString(QUAL));
              } else {
                int v = Bytes.toInt(result.getValue(FAMILY, QUAL));
                if (v != i) {
                  LOG.warn("get failed for " + i + ", the value of " + Bytes.toString(FAMILY) + ":"
                    + Bytes.toString(QUAL) + " is " + v + ", exected " + i);
                } else {
                  LOG.info("get for " + i + " succeeded");
                }
              }
              latch.countDown();
            });
          });
      });
    });
    latch.await();
    closeConn().get();
    return 0;
  }
For the example we're just using one qualifier.
hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/AsyncClientExample.java