Apache9 commented on a change in pull request #286: HBASE-22526 
RejectedExecutionException could be thrown from TableOver…
URL: https://github.com/apache/hbase/pull/286#discussion_r289643616
 
 

 ##########
 File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableOverAsyncTable.java
 ##########
 @@ -422,20 +425,29 @@ public RegionCoprocessorRpcChannel 
coprocessorService(byte[] row) {
     // get regions covered by the row range
     List<byte[]> keys = getStartKeysInRange(startKey, endKey);
     Map<byte[], Future<R>> futures = new TreeMap<>(Bytes.BYTES_COMPARATOR);
-    for (byte[] r : keys) {
-      RegionCoprocessorRpcChannel channel = coprocessorService(r);
-      Future<R> future = pool.submit(new Callable<R>() {
-        @Override
-        public R call() throws Exception {
-          R result = call.call(channel);
-          byte[] region = channel.getLastRegion();
-          if (callback != null) {
-            callback.update(region, r, result);
+    try {
+      for (byte[] r : keys) {
+        RegionCoprocessorRpcChannel channel = coprocessorService(r);
+        Future<R> future = pool.submit(new Callable<R>() {
+          @Override
+          public R call() throws Exception {
+            R result = call.call(channel);
+            byte[] region = channel.getLastRegion();
+            if (callback != null) {
+              callback.update(region, r, result);
+            }
+            return result;
           }
-          return result;
-        }
-      });
-      futures.put(r, future);
+        });
+        futures.put(r, future);
+      }
+    } catch (RejectedExecutionException e) {
+      // maybe the connection has been closed, let's check
+      if (pool.isShutdown()) {
+        throw new DoNotRetryIOException("Connection is closed");
+      } else {
+        throw new HBaseIOException("Connection is closed");
 
 Review comment:
   Fixed.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to