Update default pools size for SockJS scheduler
This change updates the XML namespace to match a change already made to the Java config.
This commit is contained in:
parent
13da7057e6
commit
5caf36ae91
|
|
@ -138,6 +138,7 @@ class WebSocketNamespaceUtils {
|
|||
RootBeanDefinition taskSchedulerDef = new RootBeanDefinition(ThreadPoolTaskScheduler.class);
|
||||
taskSchedulerDef.setSource(source);
|
||||
taskSchedulerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
taskSchedulerDef.getPropertyValues().add("poolSize", Runtime.getRuntime().availableProcessors());
|
||||
taskSchedulerDef.getPropertyValues().add("threadNamePrefix", schedulerName + "-");
|
||||
parserContext.getRegistry().registerBeanDefinition(schedulerName, taskSchedulerDef);
|
||||
parserContext.registerComponent(new BeanComponentDefinition(taskSchedulerDef, schedulerName));
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import org.springframework.messaging.simp.user.UserSessionRegistry;
|
|||
import org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler;
|
||||
import org.springframework.messaging.support.AbstractSubscribableChannel;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
import org.springframework.web.HttpRequestHandler;
|
||||
import org.springframework.web.context.support.GenericWebApplicationContext;
|
||||
|
|
@ -134,6 +135,9 @@ public class MessageBrokerBeanDefinitionParserTests {
|
|||
assertNotNull(wsTransportHandler.getHandshakeHandler());
|
||||
assertThat(wsTransportHandler.getHandshakeHandler(), Matchers.instanceOf(TestHandshakeHandler.class));
|
||||
|
||||
ThreadPoolTaskScheduler scheduler = (ThreadPoolTaskScheduler) defaultSockJsService.getTaskScheduler();
|
||||
assertEquals(Runtime.getRuntime().availableProcessors(), scheduler.getScheduledThreadPoolExecutor().getCorePoolSize());
|
||||
|
||||
UserSessionRegistry userSessionRegistry = this.appContext.getBean(UserSessionRegistry.class);
|
||||
assertNotNull(userSessionRegistry);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import org.springframework.messaging.simp.SimpMessageType;
|
|||
import org.springframework.messaging.simp.annotation.SubscribeMapping;
|
||||
import org.springframework.messaging.simp.stomp.StompCommand;
|
||||
import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.servlet.HandlerMapping;
|
||||
import org.springframework.web.servlet.handler.SimpleUrlHandlerMapping;
|
||||
|
|
@ -122,6 +123,15 @@ public class WebSocketMessageBrokerConfigurationSupportTests {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void messageBrokerSockJsTaskScheduler() {
|
||||
ThreadPoolTaskScheduler taskScheduler =
|
||||
this.config.getBean("messageBrokerSockJsTaskScheduler", ThreadPoolTaskScheduler.class);
|
||||
|
||||
assertEquals(Runtime.getRuntime().availableProcessors(),
|
||||
taskScheduler.getScheduledThreadPoolExecutor().getCorePoolSize());
|
||||
}
|
||||
|
||||
|
||||
@Controller
|
||||
static class TestController {
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class StompWebSocketIntegrationTests extends AbstractWebSocketIntegration
|
|||
|
||||
SimpleController controller = this.wac.getBean(SimpleController.class);
|
||||
try {
|
||||
assertTrue(controller.latch.await(2, TimeUnit.SECONDS));
|
||||
assertTrue(controller.latch.await(10, TimeUnit.SECONDS));
|
||||
}
|
||||
finally {
|
||||
session.close();
|
||||
|
|
|
|||
Loading…
Reference in New Issue