生产环境连接池和线程池配置参考
<bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${db.jdbc.driverClassName}" /> <property name="url" value="${db1.jdbc.url}" /> <property name="username" value="${db1.jdbc.username}" /> <property name="password" value="${db1.jdbc.password}" /> <property name="maxActive" value="20" /> <property name="maxIdle" value="3" /> <property name="maxWait" value="15000" /> <property name="timeBetweenEvictionRunsMillis" value="60000" /> <property name="minEvictableIdleTimeMillis" value="180000" /> </bean>
<!-- MQ发消息线程池 --> <bean id="taskMqExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor" > <!-- 核心线程数 --> <property name="corePoolSize" value="10" /> <!-- 最大线程数 --> <property name="maxPoolSize" value="200" /> <!-- 队列最大长度 --> <property name="queueCapacity" value="500" /> <!-- 线程池维护线程所允许的空闲时间 --> <property name="keepAliveSeconds" value="5" /> <!-- 线程池对拒绝任务(无线程可用)的处理策略 --> <property name="rejectedExecutionHandler"> <bean class="java.util.concurrent.ThreadPoolExecutor$DiscardPolicy" /> </property> </bean>