30
30
import org .springframework .core .task .TaskExecutor ;
31
31
import org .springframework .lang .Nullable ;
32
32
import org .springframework .messaging .simp .stomp .StompBrokerRelayMessageHandler ;
33
+ import org .springframework .scheduling .SchedulingTaskExecutor ;
33
34
import org .springframework .scheduling .TaskScheduler ;
34
35
import org .springframework .scheduling .concurrent .ThreadPoolTaskExecutor ;
35
36
import org .springframework .scheduling .concurrent .ThreadPoolTaskScheduler ;
@@ -239,9 +240,15 @@ public String getSockJsTaskSchedulerStatsInfo() {
239
240
if (this .sockJsTaskScheduler == null ) {
240
241
return "null" ;
241
242
}
242
- if (this .sockJsTaskScheduler instanceof ThreadPoolTaskScheduler threadPoolTaskScheduler ) {
243
- return getExecutorStatsInfo (threadPoolTaskScheduler .getScheduledThreadPoolExecutor ());
243
+
244
+ if (!(this .sockJsTaskScheduler instanceof SchedulingTaskExecutor )) {
245
+ return "thread-per-task" ;
246
+ }
247
+
248
+ if (this .sockJsTaskScheduler instanceof ThreadPoolTaskScheduler tpts ) {
249
+ return getExecutorStatsInfo (tpts .getScheduledThreadPoolExecutor ());
244
250
}
251
+
245
252
return "unknown" ;
246
253
}
247
254
@@ -250,8 +257,12 @@ private String getExecutorStatsInfo(@Nullable Executor executor) {
250
257
return "null" ;
251
258
}
252
259
253
- if (executor instanceof ThreadPoolTaskExecutor threadPoolTaskScheduler ) {
254
- executor = threadPoolTaskScheduler .getThreadPoolExecutor ();
260
+ if (!(executor instanceof SchedulingTaskExecutor ) && (executor instanceof TaskExecutor )) {
261
+ return "thread-per-task" ;
262
+ }
263
+
264
+ if (executor instanceof ThreadPoolTaskExecutor tpte ) {
265
+ executor = tpte .getThreadPoolExecutor ();
255
266
}
256
267
257
268
if (executor instanceof ThreadPoolExecutor ) {
0 commit comments