jihoonson commented on a change in pull request #5492: Native parallel batch 
indexing without shuffle
URL: https://github.com/apache/incubator-druid/pull/5492#discussion_r201891613
 
 

 ##########
 File path: 
extensions-core/kafka-indexing-service/src/main/java/io/druid/indexing/kafka/KafkaIndexTaskClient.java
 ##########
 @@ -362,317 +288,70 @@ public boolean setEndOffsets(
     log.debug("SetEndOffsets task[%s] endOffsets[%s] finalize[%s]", id, 
endOffsets, finalize);
 
     try {
-      final FullResponseHolder response = submitRequest(
+      final FullResponseHolder response = submitJsonRequest(
           id,
           HttpMethod.POST,
           "offsets/end",
           StringUtils.format("finish=%s", finalize),
-          jsonMapper.writeValueAsBytes(endOffsets),
+          serialize(endOffsets),
           true
       );
-      return response.getStatus().getCode() / 100 == 2;
+      return isSuccess(response);
     }
     catch (NoTaskLocationException e) {
       return false;
     }
     catch (IOException e) {
-      throw new RuntimeException(e);
+      throw Throwables.propagate(e);
     }
   }
 
   public ListenableFuture<Boolean> stopAsync(final String id, final boolean 
publish)
   {
-    return executorService.submit(
-        new Callable<Boolean>()
-        {
-          @Override
-          public Boolean call()
-          {
-            return stop(id, publish);
-          }
-        }
-    );
+    return doAsync(() -> stop(id, publish));
   }
 
   public ListenableFuture<Boolean> resumeAsync(final String id)
   {
-    return executorService.submit(
-        new Callable<Boolean>()
-        {
-          @Override
-          public Boolean call()
-          {
-            return resume(id);
-          }
-        }
-    );
+    return doAsync(() -> resume(id));
 
 Review comment:
   Yes, we can use CompletableFuture instead. Probably related to 
https://github.com/apache/incubator-druid/issues/5415. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@druid.apache.org
For additional commands, e-mail: dev-h...@druid.apache.org

Reply via email to