diff --git a/application/src/main/java/org/thingsboard/server/utils/EventDeduplicationExecutor.java b/application/src/main/java/org/thingsboard/server/utils/EventDeduplicationExecutor.java index 1c67868740..4ce0d2f3d5 100644 --- a/application/src/main/java/org/thingsboard/server/utils/EventDeduplicationExecutor.java +++ b/application/src/main/java/org/thingsboard/server/utils/EventDeduplicationExecutor.java @@ -56,14 +56,14 @@ public class EventDeduplicationExecutor
{
log.info("[{}] Executing task: {}", name, params);
function.accept(params);
} catch (Throwable e) {
- log.warn("Failed to process task with parameters: {}", params, e);
+ log.warn("[{}] Failed to process task with parameters: {}", name, params, e);
throw e;
} finally {
unlockAndProcessIfAny();
}
});
} catch (Throwable e) {
- log.warn("Failed to submit task with parameters: {}", params, e);
+ log.warn("[{}] Failed to submit task with parameters: {}", name, params, e);
unlockAndProcessIfAny();
throw e;
}
diff --git a/application/src/test/java/org/thingsboard/server/util/EventDeduplicationExecutorTest.java b/application/src/test/java/org/thingsboard/server/util/EventDeduplicationExecutorTest.java
index 26718b6624..c58f44e2eb 100644
--- a/application/src/test/java/org/thingsboard/server/util/EventDeduplicationExecutorTest.java
+++ b/application/src/test/java/org/thingsboard/server/util/EventDeduplicationExecutorTest.java
@@ -41,15 +41,24 @@ public class EventDeduplicationExecutorTest {
periodicFlow(MoreExecutors.newDirectExecutorService());
}
+ @Test
+ public void testExceptionFlowSameThread() throws InterruptedException {
+ exceptionFlow(MoreExecutors.newDirectExecutorService());
+ }
@Test
public void testSimpleFlowSingleThread() throws InterruptedException {
- simpleFlow(Executors.newFixedThreadPool(1));
+ simpleFlow(Executors.newSingleThreadExecutor());
}
@Test
public void testPeriodicFlowSingleThread() throws InterruptedException {
- periodicFlow(Executors.newFixedThreadPool(1));
+ periodicFlow(Executors.newSingleThreadExecutor());
+ }
+
+ @Test
+ public void testExceptionFlowSingleThread() throws InterruptedException {
+ exceptionFlow(Executors.newSingleThreadExecutor());
}
@Test
@@ -62,6 +71,11 @@ public class EventDeduplicationExecutorTest {
periodicFlow(Executors.newFixedThreadPool(3));
}
+ @Test
+ public void testExceptionFlowMultiThread() throws InterruptedException {
+ exceptionFlow(Executors.newFixedThreadPool(3));
+ }
+
private void simpleFlow(ExecutorService executorService) throws InterruptedException {
try {
Consumer