mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
87077d3fad
This change introduces removeOnCancelPolicy on ThreadPoolTaskScheduler and ScheduledExecutorFactoryBean and sets it to true for SockJS. This ensures that cancelled tasks are removed immediately to avoid the "unbounded retention of cancelled tasks" that is mentioned in the Javadoc ScheduledThreadPoolExecutor: "By default, such a cancelled task is not automatically removed from the work queue until its delay elapses. While this enables further inspection and monitoring, it may also cause unbounded retention of cancelled tasks. To avoid this, set setRemoveOnCancelPolicy to true, which causes tasks to be immediately removed from the work queue at time of cancellation." This is a backport for: https://github.com/spring-projects/spring-framework/commit/7441f2301281049cff7224bf650646490388080e Issue: SPR-11918