bbeaudreault commented on code in PR #4335:
URL: https://github.com/apache/hbase/pull/4335#discussion_r848401342


##########
hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncTableRegionLocatorImpl.java:
##########
@@ -62,7 +62,10 @@ public CompletableFuture<List<HRegionLocation>> 
getAllRegionLocations() {
           .thenApply(locs -> Arrays.asList(locs.getRegionLocations()));
       }
       return ClientMetaTableAccessor
-        .getTableHRegionLocations(conn.getTable(TableName.META_TABLE_NAME), 
tableName);
+        .getTableHRegionLocations(conn.getTable(TableName.META_TABLE_NAME), 
tableName)
+        .whenComplete((locs, error) -> {

Review Comment:
   You need to handle the case where error != null here. In that case I believe 
locs will be null, and you'll get an NPE below.  Can you add a test for this?
   
   Also, I think the convention in the async client is to use 
FutureUtils.addListener. The benefit there is it will also handle catching any 
errors thrown by your own callback.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to