use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-framework by spring-projects.
the class ReactorNettyTcpStompClientTests method setUp.
@Before
public void setUp() throws Exception {
logger.debug("Setting up before '" + this.testName.getMethodName() + "'");
int port = SocketUtils.findAvailableTcpPort(61613);
this.activeMQBroker = new BrokerService();
this.activeMQBroker.addConnector("stomp://127.0.0.1:" + port);
this.activeMQBroker.setStartAsync(false);
this.activeMQBroker.setPersistent(false);
this.activeMQBroker.setUseJmx(false);
this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5);
this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5);
this.activeMQBroker.start();
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.afterPropertiesSet();
this.client = new ReactorNettyTcpStompClient("127.0.0.1", port);
this.client.setMessageConverter(new StringMessageConverter());
this.client.setTaskScheduler(taskScheduler);
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project spring-framework by spring-projects.
the class WebSocketConfigurationSupport method defaultSockJsTaskScheduler.
/**
* The default TaskScheduler to use if none is configured via
* {@link SockJsServiceRegistration#setTaskScheduler}, i.e.
* <pre class="code">
* @Configuration
* @EnableWebSocket
* public class WebSocketConfig implements WebSocketConfigurer {
*
* public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
* registry.addHandler(myWsHandler(), "/echo").withSockJS().setTaskScheduler(myScheduler());
* }
*
* // ...
* }
* </pre>
*/
@Bean
public ThreadPoolTaskScheduler defaultSockJsTaskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setThreadNamePrefix("SockJS-");
scheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
scheduler.setRemoveOnCancelPolicy(true);
return scheduler;
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project Protocol-Adapter-OSLP by OSGP.
the class AutonomousDeviceRebootConfig method deviceRebootTaskScheduler.
@Bean(destroyMethod = "shutdown")
public TaskScheduler deviceRebootTaskScheduler() {
final ThreadPoolTaskScheduler deviceRebootTaskScheduler = new ThreadPoolTaskScheduler();
deviceRebootTaskScheduler.setPoolSize(Integer.parseInt(this.environment.getRequiredProperty(PROPERTY_NAME_AUTONOMOUS_DEVICE_REBOOT_POOL_SIZE)));
deviceRebootTaskScheduler.setThreadNamePrefix(this.environment.getRequiredProperty(PROPERTY_NAME_AUTONOMOUS_DEVICE_REBOOT_THREAD_NAME_PREFIX));
deviceRebootTaskScheduler.setWaitForTasksToCompleteOnShutdown(false);
return deviceRebootTaskScheduler;
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project Protocol-Adapter-OSLP by OSGP.
the class EveningMorningBurnersLightSwitchingOnConfig method eveningMorningBurnerslightSwitchingOnTaskScheduler.
@Bean(destroyMethod = "shutdown")
public TaskScheduler eveningMorningBurnerslightSwitchingOnTaskScheduler() {
final ThreadPoolTaskScheduler eveningMorningBurnerslightSwitchingOnTaskScheduler = new ThreadPoolTaskScheduler();
eveningMorningBurnerslightSwitchingOnTaskScheduler.setPoolSize(Integer.parseInt(this.environment.getRequiredProperty(PROPERTY_NAME_AUTONOMOUS_EVENING_MORNING_BURNER_LIGHTSWITCHING_ON_POOL_SIZE)));
eveningMorningBurnerslightSwitchingOnTaskScheduler.setThreadNamePrefix(this.environment.getRequiredProperty(PROPERTY_NAME_AUTONOMOUS_EVENING_MORNING_BURNER_LIGHTSWITCHING_ON_THREAD_NAME_PREFIX));
eveningMorningBurnerslightSwitchingOnTaskScheduler.setWaitForTasksToCompleteOnShutdown(false);
return eveningMorningBurnerslightSwitchingOnTaskScheduler;
}
use of org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler in project Protocol-Adapter-OSLP by OSGP.
the class EventNotificationTransitionConfig method eventNotificationTaskScheduler.
@Bean(destroyMethod = "shutdown")
public TaskScheduler eventNotificationTaskScheduler() {
final ThreadPoolTaskScheduler eventNotificationTaskScheduler = new ThreadPoolTaskScheduler();
eventNotificationTaskScheduler.setPoolSize(Integer.parseInt(this.environment.getRequiredProperty(PROPERTY_NAME_AUTONOMOUS_EVENTNOTIFICATION_POOL_SIZE)));
eventNotificationTaskScheduler.setThreadNamePrefix(this.environment.getRequiredProperty(PROPERTY_NAME_AUTONOMOUS_EVENTNOTIFICATION_THREAD_NAME_PREFIX));
eventNotificationTaskScheduler.setWaitForTasksToCompleteOnShutdown(false);
return eventNotificationTaskScheduler;
}
Aggregations