You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by GitBox <gi...@apache.org> on 2019/05/07 23:16:00 UTC

[GitHub] [samza] weisong44 commented on a change in pull request #991: [SAMZA-2162] - Update Table APIs to be consistent with High level Async API

weisong44 commented on a change in pull request #991: [SAMZA-2162] - Update Table APIs to be consistent with High level Async API
URL: https://github.com/apache/samza/pull/991#discussion_r281862773
 
 

 ##########
 File path: samza-api/src/main/java/org/apache/samza/table/remote/TableWriteFunction.java
 ##########
 @@ -102,43 +95,37 @@ default void putAll(List<Entry<K, V>> records) {
    * @param key key to the table record to be deleted
    */
   default void delete(K key) {
-    try {
-      deleteAsync(key).get();
-    } catch (InterruptedException | ExecutionException e) {
-      throw new SamzaException("DELETE failed for " + key, e);
-    }
+    deleteAsync(key).toCompletableFuture().join();
   }
 
   /**
    * Asynchronously delete the {@code record} with specified {@code key} from the remote store
    * @param key key to the table record to be deleted
-   * @return CompletableFuture for the delete request
+   * @return CompletionStage for the delete request
    */
-  CompletableFuture<Void> deleteAsync(K key);
+  CompletionStage<Void> deleteAsync(K key);
 
   /**
    * Delete all {@code records} with the specified {@code keys} from the remote store
    * The default implementation calls deleteAllAsync and blocks on the completion afterwards.
    * @param keys keys for the table records to be written
    */
   default void deleteAll(Collection<K> keys) {
-    try {
-      deleteAllAsync(keys).get();
-    } catch (InterruptedException | ExecutionException e) {
-      throw new SamzaException("DELETE failed for " + keys, e);
-    }
+    deleteAllAsync(keys).toCompletableFuture().join();
 
 Review comment:
   +1
   Should catch and re-throw

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services