123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:cache="http://www.springframework.org/schema/cache"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/cache
- http://www.springframework.org/schema/cache/spring-cache.xsd">
- <cache:annotation-driven cache-manager="cacheManager" />
- <!--spring 线程池-->
- <bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
- <!-- 线程池维护线程的最少数量 -->
- <property name="corePoolSize" value="8" />
- <!-- 允许的空闲时间 -->
- <property name="keepAliveSeconds" value="200" />
- <!-- 线程池维护线程的最大数量 -->
- <property name="maxPoolSize" value="32" />
- <!-- 缓存队列 -->
- <property name="queueCapacity" value="32" />
- <!-- 对拒绝task的处理策略 -->
- <property name="rejectedExecutionHandler">
- <bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/>
- </property>
- </bean>
- <bean id="batchExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
- <!-- 线程池维护线程的最少数量 -->
- <property name="corePoolSize" value="2" />
- <!-- 允许的空闲时间 -->
- <property name="keepAliveSeconds" value="200" />
- <!-- 线程池维护线程的最大数量 -->
- <property name="maxPoolSize" value="4" />
- <!-- 缓存队列 -->
- <property name="queueCapacity" value="4" />
- <!-- 对拒绝task的处理策略 -->
- <property name="rejectedExecutionHandler">
- <bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy"/>
- </property>
- </bean>
- </beans>
|