dengpanyin 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_r276482480
##########
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:
remote the exception may break some apps which is relying on the exception
type.
----------------------------------------------------------------
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