Add missing check to avoid re-initialization
Noticed during review of #28736 that a check protecting against
re-initialization was accidentally removed in commit
3d6e38bb43.
This commit is contained in:
@@ -84,12 +84,14 @@ public class WebSocketConfigurationSupport {
|
||||
@Bean
|
||||
@Nullable
|
||||
public TaskScheduler defaultSockJsTaskScheduler() {
|
||||
if (initHandlerRegistry().requiresTaskScheduler()) {
|
||||
ThreadPoolTaskScheduler threadPoolScheduler = new ThreadPoolTaskScheduler();
|
||||
threadPoolScheduler.setThreadNamePrefix("SockJS-");
|
||||
threadPoolScheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
|
||||
threadPoolScheduler.setRemoveOnCancelPolicy(true);
|
||||
this.scheduler = threadPoolScheduler;
|
||||
if (this.scheduler == null) {
|
||||
if (initHandlerRegistry().requiresTaskScheduler()) {
|
||||
ThreadPoolTaskScheduler threadPoolScheduler = new ThreadPoolTaskScheduler();
|
||||
threadPoolScheduler.setThreadNamePrefix("SockJS-");
|
||||
threadPoolScheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
|
||||
threadPoolScheduler.setRemoveOnCancelPolicy(true);
|
||||
this.scheduler = threadPoolScheduler;
|
||||
}
|
||||
}
|
||||
return this.scheduler;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user