comnetwork commented on code in PR #4463:
URL: https://github.com/apache/hbase/pull/4463#discussion_r889492611


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/HBaseInterClusterReplicationEndpoint.java:
##########
@@ -394,29 +375,30 @@ List<List<Entry>> filterNotExistColumnFamilyEdits(final 
List<List<Entry>> oldEnt
     return entryList;
   }
 
-  private long parallelReplicate(CompletionService<Integer> pool, 
ReplicateContext replicateContext,
-    List<List<Entry>> batches) throws IOException {
-    int futures = 0;
+  private long parallelReplicate(ReplicateContext replicateContext, 
List<List<Entry>> batches)
+    throws IOException {
+    List<CompletableFuture<Integer>> futures =
+      new ArrayList<CompletableFuture<Integer>>(batches.size());
     for (int i = 0; i < batches.size(); i++) {
       List<Entry> entries = batches.get(i);
-      if (!entries.isEmpty()) {
-        if (LOG.isTraceEnabled()) {
-          LOG.trace("{} Submitting {} entries of total size {}", logPeerId(), 
entries.size(),
-            replicateContext.getSize());
-        }
-        // RuntimeExceptions encountered here bubble up and are handled in 
ReplicationSource
-        pool.submit(createReplicator(entries, i, 
replicateContext.getTimeout()));
-        futures++;
+      if (entries.isEmpty()) {
+        continue;
       }
+      if (LOG.isTraceEnabled()) {
+        LOG.trace("{} Submitting {} entries of total size {}", logPeerId(), 
entries.size(),
+          replicateContext.getSize());
+      }
+      // RuntimeExceptions encountered here bubble up and are handled in 
ReplicationSource
+      futures.add(createReplicator(entries, i, replicateContext.getTimeout()));
     }
 
     IOException iox = null;
     long lastWriteTime = 0;
-    for (int i = 0; i < futures; i++) {
+
+    for (CompletableFuture<Integer> f : futures) {
       try {
         // wait for all futures, remove successful parts
         // (only the remaining parts will be retried)
-        Future<Integer> f = pool.take();
         int index = f.get();

Review Comment:
   I have fixed it



-- 
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