File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
modules/client/src/main/java/org/apache/ignite/internal/client/tx Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 1919
2020import static org .apache .ignite .internal .client .tx .ClientTransactions .USE_CONFIGURED_TIMEOUT_DEFAULT ;
2121import static org .apache .ignite .internal .util .CompletableFutures .nullCompletedFuture ;
22- import static org .apache .ignite .internal .util .ExceptionUtils .sneakyThrow ;
2322
2423import java .util .EnumSet ;
2524import java .util .concurrent .CompletableFuture ;
@@ -108,24 +107,23 @@ public CompletableFuture<Void> rollbackAsync() {
108107 }
109108
110109 // If the transaction is not started. Issue the rollback and wait for the server response.
111- CompletableFuture <Void > ret ;
112110 if (!tx0 .isDone () && cancelled .compareAndSet (false , true )) {
113- ret = requestInfoFuture
111+ return requestInfoFuture
114112 .thenCompose (reqInfo ->
115113 reqInfo .ch .serviceAsync (ClientOp .TX_ROLLBACK , w -> w .out ().packLong (-reqInfo .firstReqId ), r -> null )
116114 )
117115 .handle ((res , e ) -> {
118- if (e != null ) {
119- throw sneakyThrow (ViewUtils .ensurePublicException (e ));
116+ // If ok, we don't need to wait for the response. If error, let's block.
117+ if (e == null ) {
118+ return nullCompletedFuture ();
119+ } else {
120+ return tx0 .thenCompose (ClientTransaction ::rollbackAsync );
120121 }
121-
122- return null ;
123- });
122+ })
123+ .thenCompose (f -> (CompletableFuture <Void >) f );
124124 } else {
125- ret = nullCompletedFuture ( );
125+ return tx0 . thenCompose ( ClientTransaction :: rollbackAsync );
126126 }
127-
128- return ret .thenCompose (none -> tx0 .thenCompose (ClientTransaction ::rollbackAsync ));
129127 }
130128
131129 @ Override
You can’t perform that action at this time.
0 commit comments