From 333bea55eb3ce9170b4c58de56a575ad30749ebe Mon Sep 17 00:00:00 2001 From: "Andreas Fankhauser hiddenalpha.ch" <23085769+hiddenalpha@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:19:11 +0100 Subject: [PATCH] SDCISA-18302: Add logging in case unreachable code gets reached. --- .../swisspush/redisques/performance/UpperBoundParallel.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/swisspush/redisques/performance/UpperBoundParallel.java b/src/main/java/org/swisspush/redisques/performance/UpperBoundParallel.java index d0a8aa1..204c293 100644 --- a/src/main/java/org/swisspush/redisques/performance/UpperBoundParallel.java +++ b/src/main/java/org/swisspush/redisques/performance/UpperBoundParallel.java @@ -132,7 +132,11 @@ private void resume(Request req) { // this boolean is just for paranoia, in case mentor tries to call back too often. final AtomicBoolean isCalled = new AtomicBoolean(); @Override public void accept(Throwable ex, Void ret) { - if (!isCalled.compareAndSet(false, true)) return; + if (!isCalled.compareAndSet(false, true)) { + if (log.isDebugEnabled()) log.warn("This callback MUST NOT be called multiple times!! Make sure caller only calls it ONCE!", new Exception("stacktrace")); + else log.warn("This callback MUST NOT be called multiple times!! Make sure caller only calls it ONCE! (enable debug log to see stack)"); + return; + } onOneDone(req, ex); } }, req.ctx);