<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "/spring-beans.dtd">

<beans>

<!-- 异步线程池 -->  

<bean id="threadPool" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">  

<!-- 核心线程数  -->  

<property name="corePoolSize" value="10" />  

<!-- 最大线程数 -->  

<property name="maxPoolSize" value="50" />  

<!-- 队列最大长度 >=mainExecutor.maxSize -->  

<property name="queueCapacity" value="1000" />  

<!-- 线程池维护线程所允许的空闲时间 -->  

<property name="keepAliveSeconds" value="300" />  

<!-- 线程池对拒绝任务(无线程可用)的处理策略 -->  

<property name="rejectedExecutionHandler">  

<bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy" />  

</property>  

</bean>

<bean id="mainExecutor" class="supben.MainExecutor">

<property name="threadPool" ref="threadPool" />

</bean>

<bean id="springScheduleExecutorTask" class="org.springframework.scheduling.concurrent.ScheduledExecutorTask">

<property name="runnable" ref="mainExecutor" />

<!-- 容器加载10秒后开始执行 -->

<property name="delay" value="10000" />

<!-- 每次任务间隔 5秒-->

<property name="period" value="5000" />

</bean>

<bean id="springScheduledExecutorFactoryBean" class="org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean">

<property name="scheduledExecutorTasks">

<list>

<ref bean="springScheduleExecutorTask" />

</list>

</property>

</bean>

</beans>

Spring线程池的5个要素的更多相关文章

  1. Spring线程池开发实战

    Spring线程池开发实战 作者:chszs,转载需注明. 作者博客主页:http://blog.csdn.net/chszs 本文提供了三个Spring多线程开发的例子,由浅入深,由于例子一目了然, ...

  2. Spring线程池配置模板设计(基于Springboot)

    目录 线程池配置模板 基础的注解解释 常用配置参数 配置类设计 线程池使用 ThreadPoolTaskExecutor源码 线程池配置模板 springboot给我们提供了一个线程池的实现,它的底层 ...

  3. Spring线程池ThreadPoolTaskExecutor配置及详情

    Spring线程池ThreadPoolTaskExecutor配置及详情 1. ThreadPoolTaskExecutor配置 <!-- spring thread pool executor ...

  4. 分享知识-快乐自己:Spring线程池配置

    Spring通过ThreadPoolTaskExecutor实现线程池技术,它是使用jdk中的Java.util.concurrent.ThreadPoolExecutor进行实现. Spring 配 ...

  5. Spring线程池由浅入深的3个示例

    作者博客主页:http://blog.csdn.net/chszs 本文提供了三个Spring多线程开发的例子,由浅入深,由于例子一目了然,所以并未做过多的解释.诸位一看便知. 前提条件: 1)在Ec ...

  6. 【SSM Spring 线程池 OJ】 使用Spring线程池ThreadPoolTaskExecutor

    最近做的Online Judge项目,在本地判题的实现过程中,遇到了一些问题,包括多线程,http通信等等.现在完整记录如下: OJ有一个业务是: 用户在前端敲好代码,按下提交按钮发送一个判题请求给后 ...

  7. spring线程池的同步和异步(1)

    spring线程池(同步.异步) 一.spring异步线程池类图 二.简单介绍 2.1. TaskExecutor---Spring异步线程池的接口类,其实质是java.util.concurrent ...

  8. 007-多线程-JUC线程池-Spring线程池配置、池子如何配置参数

    一.概述 Spring通过ThreadPoolTaskExecutor实现线程池技术,它是使用jdk中的Java.util.concurrent.ThreadPoolExecutor进行实现. 1.1 ...

  9. JDK线程池和Spring线程池的使用

    JDK线程池和Spring线程池实例,异步调用,可以直接使用 (1)JDK线程池的使用,此处采用单例的方式提供,见示例: public class ThreadPoolUtil { private s ...

随机推荐

  1. vscode 创建.net core mvc

    cd 进一个文件夹 1,创建一个sln 工程文件  [ dotnet new sln -n Demo1 ] 2,创建一个mvc项目 [ dotnet new mvc -n Demo1.Web ] 3, ...

  2. mySQL explain解释

    1).id列 数字越大越先执行,如果说数字一样大,那么就从上往下依次执行,id列为null的就表是这是一个结果集,不需要使用它来进行查询.   2).select_type列常见的有: A:simpl ...

  3. 50个常用的Linux命令(二)sed

    [root@localhost cee]# echo this thisthisthis |sed 's/this/THIS/g'THIS THISTHISTHIS[root@localhost ce ...

  4. 使用md5加密算法完成简单的登录和注册功能

    原理: 登录:后端controller层获取到客户的密码,通过下面代码:new Sha256Hash(pwd).toHex();将密码转换成md5散列,生成一个新的字符串与数据库的值进行比对,根据不同 ...

  5. touchend偶尔不触发(待解决)

    新闻流,实现tab横向切换效果,出现偶尔切到一半,手指移开后,没有跳转到上一个或下一个tab,而是持续在当前切了一半的位置. 找到原因: 没有切换的时候,touchend都没有触发. 网上找到的解决办 ...

  6. L328 What Is Millennial Burnout?

    What Is Millennial Burnout?Do you often feel stressed? Does the pace of life make you feel like you' ...

  7. 0913_Python初识及变量

    1.Python3不需加utf-8,Python必须加utf-82.单行注释用#,多行注释用""" """3.变量:只能由字母.数字.下划线 ...

  8. https://www.cnblogs.com/wuyepiaoxue/p/5661194.html

    https://www.cnblogs.com/wuyepiaoxue/p/5661194.html

  9. 一条命令将windows下多个ts文件合并为一个ts文件

    首先在待合并的文件夹下创建concat.bat(名字随意啦),写入如下命令 copy /b "%~dp0"\*.ts "%~dp0"\new.ts 执行该命令后 ...

  10. 20155219 mybash的实现

    第五周加分题--mybash的实现 题目要求 1.使用fork,exec,wait实现mybash 2.写出伪代码,产品代码和测试代码 3.发表知识理解,实现过程和问题解决的博客(包含代码托管链接) ...