ascherbakoff commented on code in PR #1183:
URL: https://github.com/apache/ignite-3/pull/1183#discussion_r991842414


##########
modules/api/src/main/java/org/apache/ignite/tx/IgniteTransactions.java:
##########
@@ -130,4 +132,22 @@ default <T> T runInTransaction(Function<Transaction, T> 
clo) throws TransactionE
             throw t;
         }
     }
+
+    /**
+     * Executes a closure within a transaction asynchronously.
+     *
+     * <p>A returned future must be the last in the asynchronous chain. This 
means all transaction operations happen before the future
+     * is completed.
+     *
+     * <p>If the asynchronous chain resulted in no exception, the commitAsync 
will be automatically called.
+     *
+     * @param clo The closure.
+     * @param <T> Closure result type.
+     * @return The result.
+     */
+    default <T> CompletableFuture<T> 
runInTransactionAsync(Function<Transaction, CompletableFuture<T>> clo) {
+        // Rollback is expected to be called by the failure handling code

Review Comment:
   **As far as I understand you expect user to have op.handle(tx.rollback)** - 
no I don't expect this. 
   I expect that a transaction will be already rolled back by a user or 
automatically by txn engine (in case of error) by the async chain end, so there 
is no need to call it again.
   
   catch (Throwable t) in the aforementioned block is actually a protection 
from unchecked exception to avoid not closed transactions



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to