OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] jihoonson commented on a change in pull request #5492: Native parallel batch indexing without shuffle


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:
users@xxxxxxxxxxxxxxxx


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: dev-help@xxxxxxxxxxxxxxxx