This is an automated email from the ASF dual-hosted git repository.
apkhmv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 560c6da4af IGNITE-21282 Fix flaky
ItComputeTestEmbedded#cancelsJobLocally (#3060)
560c6da4af is described below
commit 560c6da4afb067abe628d5d58872d9111ba477e1
Author: Vadim Pakhnushev <[email protected]>
AuthorDate: Wed Jan 17 14:01:49 2024 +0300
IGNITE-21282 Fix flaky ItComputeTestEmbedded#cancelsJobLocally (#3060)
---
.../java/org/apache/ignite/internal/compute/queue/QueueEntry.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/modules/compute/src/main/java/org/apache/ignite/internal/compute/queue/QueueEntry.java
b/modules/compute/src/main/java/org/apache/ignite/internal/compute/queue/QueueEntry.java
index 89e0fafba6..499c11d860 100644
---
a/modules/compute/src/main/java/org/apache/ignite/internal/compute/queue/QueueEntry.java
+++
b/modules/compute/src/main/java/org/apache/ignite/internal/compute/queue/QueueEntry.java
@@ -49,7 +49,7 @@ class QueueEntry<R> implements Runnable,
Comparable<QueueEntry<R>> {
private final Lock lock = new ReentrantLock();
- private boolean isInterrupted;
+ private volatile boolean isInterrupted;
/**
* Constructor.
@@ -103,8 +103,10 @@ class QueueEntry<R> implements Runnable,
Comparable<QueueEntry<R>> {
lock.lock();
try {
if (workerThread != null) {
- workerThread.interrupt();
+ // Set the interrupted flag first since it's used to determine
the final status of the job.
+ // Job could handle interruption and exit before this flag is
set moving the job to completed state rather than canceled.
isInterrupted = true;
+ workerThread.interrupt();
}
} finally {
lock.unlock();