Spring TaskExecutor的用法
来源:互联网 发布:淘宝网店代销好吗 编辑:程序博客网 时间:2024/05/21 09:19
bean的写法
<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor"> <!-- 核心线程数,默认为1 --> <property name="corePoolSize" value="10" /> <!-- 最大线程数,默认为Integer.MAX_VALUE --> <property name="maxPoolSize" value="50" /> <!-- 队列最大长度,一般需要设置值>=notifyScheduledMainExecutor.maxnum;默认为Integer.MAX_VALUE --> <property name="queueCapacity" value="1000" /> <!-- 线程池维护线程所允许的空闲时间,默认为60s --> <property name="keepAliveSeconds" value="300"/> <!-- 线程池对拒绝任务的(无线程可用)的处理策略 --> <property name="rejectedExecutionHandler"> <bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/> </property> </bean>
测试用例:
@Rollback(false) @Test public void testThread(){ //业务逻辑1 taskExecutor.execute(new Runnable(){ @Override public void run(){ //业务逻辑2 } }); //业务逻辑3 }
0 0
- Spring TaskExecutor的用法
- spring TaskExecutor
- Spring TaskExecutor
- 使用Spring的taskExecutor实现线程池
- spring boot Async taskExecutor
- 使用Spring的TaskExecutor的线程池执行异步操作
- spring 集成线程池(TaskExecutor)
- TaskExecutor
- TaskExecutor
- Spring taskExecutor运行后台线程在Tomcat停止时时主动退出的方法
- spring taskExecutor redis redisMessageListenerContailner线程优化
- <?>getCurrentSession绑定的线程,需不需要taskExecutor
- SpringMVC整合TaskExecutor线程池的配置/使用
- SpringMVC整合TaskExecutor线程池的配置/使用
- springmvc整合TaskExecutor线程池的配置/使用
- SpringMVC整合TaskExecutor线程池的配置/使用
- taskExecutor使用
- Spring的IOC用法
- Swap Nodes in Pairs
- SurfaceView
- 9.6.2 哈希查找之开放定址法解决哈希碰撞
- Java同步
- BNUOJ 8108
- Spring TaskExecutor的用法
- 模仿JD导航界面
- php 如何获取文件的后缀名,比如图片扩展名jpg,gif等
- UVALive 7041 The Problem to Slow Down You(回文树)
- android 还可以输入多少个字符
- [MySQL]分组后查找每组的前N条记录语句
- 《CSS权威指南》学习记录——内边距、边框、外边距
- NSRange
- iOS开发 React-native开发环境配置