From 78efaacd297021ca676341c3f0e919ccf4803b93 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. --- .../redisques/performance/UpperBoundParallel.java | 7 ++++++- 1 file changed, 6 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..5a0b813 100644 --- a/src/main/java/org/swisspush/redisques/performance/UpperBoundParallel.java +++ b/src/main/java/org/swisspush/redisques/performance/UpperBoundParallel.java @@ -132,7 +132,12 @@ 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)) { + boolean d = log.isDebugEnabled(); + log.error("This callback MUST NOT be called multiple times!! Make sure caller only calls it ONCE!{}", + d ? "" : " (enable debug log to see stack)", d ? new Exception("here a stack for you") : (Exception) null); + return; + } onOneDone(req, ex); } }, req.ctx);