Skip to content

Commit

Permalink
isAsync takes precedence over OperationHostileThread (#484)
Browse files Browse the repository at this point in the history
Import of #26227

**Original PR description:**

Fixes #24712
OperationExecutor allows async invocation of OperationHostileThread.

Imported changes:

- ad43e41 isAsync takes precedence over
OperationHostileThread

Closes #26227

Co-authored-by: Lukáš Herman <lukas.herman@cgi.com>
GitOrigin-RevId: ed32fc9cca084cfc14ad6b846931fbd3798b6820
  • Loading branch information
lukasherman authored and actions-user committed Apr 10, 2024
1 parent 4ace14e commit 2749200
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,16 +520,16 @@ public boolean isInvocationAllowed(Operation op, boolean isAsync) {

Thread currentThread = Thread.currentThread();

// IO threads are not allowed to run any operation
if (currentThread instanceof OperationHostileThread) {
return false;
}

// if it is async we don't need to check if it is PartitionOperationThread or not
if (isAsync) {
return true;
}

// IO threads are not allowed to run any operation
if (currentThread instanceof OperationHostileThread) {
return false;
}

// allowed to invoke non partition specific task
if (op.getPartitionId() < 0) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public Boolean call() throws Exception {
DummyOperationHostileThread hostileThread = new DummyOperationHostileThread(futureTask);
hostileThread.start();

assertEqualsEventually(futureTask, FALSE);
assertEqualsEventually(futureTask, TRUE);
}

// ===================== partition specific operations ========================
Expand Down Expand Up @@ -249,6 +249,6 @@ public Boolean call() throws Exception {
DummyOperationHostileThread thread = new DummyOperationHostileThread(futureTask);
thread.start();

assertEqualsEventually(futureTask, FALSE);
assertEqualsEventually(futureTask, TRUE);
}
}

0 comments on commit 2749200

Please sign in to comment.