Skip to content

Commit

Permalink
Merge pull request #231 from hiddenalpha/AddLoggingInCaseUnreachableC…
Browse files Browse the repository at this point in the history
…odeGetsReached-20241210

SDCISA-18302: Add logging in case unreachable code gets reached.
  • Loading branch information
hiddenalpha authored Dec 11, 2024
2 parents 447c105 + 78efaac commit fdedb29
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,12 @@ private <Ctx> void resume(Request<Ctx> 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);
Expand Down

0 comments on commit fdedb29

Please # to comment.