本文整理匯總了Java中org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler.setRemoveOnCancelPolicy方法的典型用法代碼示例。如果您正苦於以下問題:Java ThreadPoolTaskScheduler.setRemoveOnCancelPolicy方法的具體用法?Java ThreadPoolTaskScheduler.setRemoveOnCancelPolicy怎麽用?Java ThreadPoolTaskScheduler.setRemoveOnCancelPolicy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler
的用法示例。
在下文中一共展示了ThreadPoolTaskScheduler.setRemoveOnCancelPolicy方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: taskScheduler
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; //導入方法依賴的package包/類
@Bean()
public ThreadPoolTaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(100);
scheduler.setThreadNamePrefix("Scheduler-");
scheduler.setWaitForTasksToCompleteOnShutdown(true);
scheduler.setRemoveOnCancelPolicy(true);
return scheduler;
}
示例2: messageBrokerTaskScheduler
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; //導入方法依賴的package包/類
@Bean(name={"messageBrokerTaskScheduler", "messageBrokerSockJsTaskScheduler"})
public ThreadPoolTaskScheduler messageBrokerTaskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setThreadNamePrefix("MessageBroker-");
scheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
scheduler.setRemoveOnCancelPolicy(true);
return scheduler;
}
示例3: registrationTaskScheduler
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; //導入方法依賴的package包/類
@Bean
@Qualifier("registrationTaskScheduler")
public TaskScheduler registrationTaskScheduler() {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.setPoolSize(1);
taskScheduler.setRemoveOnCancelPolicy(true);
taskScheduler.setThreadNamePrefix("registrationTask");
return taskScheduler;
}
示例4: defaultSockJsTaskScheduler
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; //導入方法依賴的package包/類
/**
* 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;
}
示例5: messageBrokerSockJsTaskScheduler
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; //導入方法依賴的package包/類
/**
* The default TaskScheduler to use if none is configured via
* {@link SockJsServiceRegistration#setTaskScheduler(org.springframework.scheduling.TaskScheduler)}
* , i.e.
*
* <pre class="code">
* @Configuration
* public class WampConfig extends DefaultWampConfiguration {
*
* public void registerWampEndpoints(WampEndpointRegistry registry) {
* registry.addEndpoint("/wamp").withSockJS().setTaskScheduler(myScheduler());
* }
*
* // ...
* }
* </pre>
*/
@Bean
public ThreadPoolTaskScheduler messageBrokerSockJsTaskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setThreadNamePrefix("WampSockJS-");
scheduler.setPoolSize(Runtime.getRuntime().availableProcessors());
scheduler.setRemoveOnCancelPolicy(true);
return scheduler;
}