You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in DefaultMessageListenerContainer.applyBackOffTime(BackOffExecution execution) function the current thread is sleeping during the back off interval. This prevents container to shutdown correctly (as it waits for this thread to wake up).
I suggest to rewrite this function using .wait() calls:
finallonginterval = execution.nextBackOff();
if (interval == BackOffExecution.STOP)
returnfalse;
if (isRecovering() && interrupted)
// Interrupted right before and still failing... give up.returnfalse;
try {
synchronized (this.lifecycleMonitor) {
finallongstart = System.currentTimeMillis();
while (isActive() && System.currentTimeMillis() - start < interval) {
finallongtimeout = getReceiveTimeout();
this.lifecycleMonitor.wait(timeout > 0 ? timeout : DEFAULT_RECEIVE_TIMEOUT);
}
}
} catch (InterruptedExceptioninterEx) {
// Re-interrupt current thread, to allow other threads to react.Thread.currentThread().interrupt();
if (isRecovering())
this.interrupted = true;
}
returntrue;
To the best of my understanding, a simple switch to lifecycleMonitor.wait(recoveryInterval) should do the job, allowing for notifyAll to reach it. During a recovery phase, our invoker infrastructure just triggers such a notification in case of a stop call or a full shutdown, both of which turn isRunning to false... so if applyBackOffTime exits normally, the surrounding loop will automatically check isRunning and end the refresh attempt.
I've implemented this for 4.3 RC2. Feel free to give the upcoming 4.3.0.BUILD-SNAPSHOT an early try...
Oleg Ivanov opened SPR-14200 and commented
Currently in DefaultMessageListenerContainer.applyBackOffTime(BackOffExecution execution) function the current thread is sleeping during the back off interval. This prevents container to shutdown correctly (as it waits for this thread to wake up).
I suggest to rewrite this function using .wait() calls:
Affects: 4.2.5
Issue Links:
Referenced from: commits 6ab8d36
The text was updated successfully, but these errors were encountered: