petrov-mg commented on code in PR #11176:
URL: https://github.com/apache/ignite/pull/11176#discussion_r1485638683


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java:
##########
@@ -3653,6 +3654,52 @@ public void awaitLastFut() {
         }
     }
 
+    /**
+     * Replaces previous async operation future on transaction suspend.
+     */
+    public @Nullable FutureHolder suspendLastFut() {
+        FutureHolder holder = lastFut.get();
+
+        IgniteInternalFuture fut = holder.future();
+
+        if (fut != null && !fut.isDone()) {
+            lastFut.set(new FutureHolder());
+
+            return holder;
+        }
+        else
+            return null;
+    }
+
+    /**
+     * Replaces previous async operation future on transaction resume.
+     */
+    public void resumeLastFut(FutureHolder holder) {
+        IgniteInternalFuture resumedFut = holder.future();
+
+        if (resumedFut == null || resumedFut.isDone())
+            return;
+
+        FutureHolder threadHolder = lastFut.get();
+
+        IgniteInternalFuture threadFut = threadHolder.future();
+
+        if (threadFut != null && !threadFut.isDone()) {
+            threadHolder.lock();

Review Comment:
   It seems that we should also check that `threadFut` is not null and is not 
completed after lock is acquired , because `FutureHolder` can be cleared 
concurrently.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to