From ad43e41676ad3d90e7aa75e95c616698ecf7dbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Herman?= Date: Tue, 23 Jan 2024 13:03:32 +0100 Subject: [PATCH] isAsync takes precedence over OperationHostileThread fixes #24712 --- .../operationexecutor/impl/OperationExecutorImpl.java | 10 +++++----- .../OperationExecutorImpl_IsInvocationAllowedTest.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hazelcast/src/main/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl.java b/hazelcast/src/main/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl.java index 4faf70402bff..cd0757e65ee4 100644 --- a/hazelcast/src/main/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl.java +++ b/hazelcast/src/main/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl.java @@ -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; diff --git a/hazelcast/src/test/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl_IsInvocationAllowedTest.java b/hazelcast/src/test/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl_IsInvocationAllowedTest.java index 622342278c0a..f71eae437acb 100644 --- a/hazelcast/src/test/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl_IsInvocationAllowedTest.java +++ b/hazelcast/src/test/java/com/hazelcast/spi/impl/operationexecutor/impl/OperationExecutorImpl_IsInvocationAllowedTest.java @@ -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 ======================== @@ -249,6 +249,6 @@ public Boolean call() throws Exception { DummyOperationHostileThread thread = new DummyOperationHostileThread(futureTask); thread.start(); - assertEqualsEventually(futureTask, FALSE); + assertEqualsEventually(futureTask, TRUE); } }