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:
Rossen Stoyanchev
2014-03-24 21:44:03 -04:00
parent 13da7057e6
commit 5caf36ae91
4 changed files with 16 additions and 1 deletions

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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();