tomcat提供的线程池
来源:互联网 发布:程序员自我评价 编辑:程序博客网 时间:2024/05/21 00:14
这里先写一些如何在tomcat中配置线程池调用吧:
配置很简单 ,打开%TOMCAT_HOME%/conf/server.xml:
第一步,打开共享的线程池
源码
<Service name="Catalina">
默认前后是注释<!-- -->掉的,去掉就可以了。其中
name
The name used to reference this pool in other places in server.xml. The name is required and must be unique.
这个是线程池的名字,必须唯一,我们在后面的配置里要用到这个东西
namePrefix
(String) The name prefix for each thread created by the executor. The thread name for an individual thread will be namePrefix+threadNumber
线程的名字前缀,用来标记线程名字的,这样每个线程就用这个前缀加上线程编号了,比如
catalina-exec-1
catalina-exec-2
maxThreads
(int) The max number of active threads in this pool, default is 200
允许的最大线程池里的线程数量,默认是200,大的并发应该设置的高一些,反正只是限制而已,不占用资源
minSpareThreads
(int) The minimum number of threads always kept alive, default is 25
最小的保持活跃的线程数量,默认是25.这个要根据负载情况自行调整了。太小了就影响反应速度,太大了白白占用资源。
maxIdleTime
(int) The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads. Default value is 60000(1 minute)
超过最小活跃线程数量的线程,如果空闲时间超过这个设置后,会被关别。默认是1分钟。
threadPriority
(int) The thread priority for threads in the executor, the default is Thread.NORM_PRIORITY
线程的等级。默认是Thread.NORM_PRIORITY
第二步
在 Connector里指定使用共享线程池
<Connector port="8080" protocol="HTTP/1.1" redirectPort="8443" connectionTimeout="20000" executor="tomcatThreadPool" acceptCount="100" useBodyEncodingForURI="true" enableLookups="false" />
- tomcat提供的线程池
- tomcat提供的线程池
- Executors提供的四种线程池
- Executors提供的四种线程池
- Tomcat提供的安全机制
- TOMCAT线程池的配置
- TOMCAT的线程池实现
- Tomcat的线程池实现
- tomcat线程池的实现
- VC中使用系统提供的线程池
- VC中使用系统提供的线程池
- VC中使用系统提供的线程池
- VC中使用系统提供的线程池
- VC中使用系统提供的线程池
- VC中使用系统提供的线程池
- java Executor 提供的五种线程池
- 利用spring提供的线程池发送邮件
- Spring提供的并发线程池测试使用
- 第14周项目1-小玩文件(3)
- 《大话设计模式》--OOTV杯超级模式大赛--模式总结(29-D)
- Effective C++ 条款51
- 第十四周项目一 小玩文件之统计文本文件中的字符个数
- 618大促,海信空调如何“征服”消费者?
- tomcat提供的线程池
- android 震动
- 第十五周阅读项目(2)
- IE7、IE8不兼容问题,TR下边框不显示
- android的发展
- C++实现DES加密解密
- log4j不同业务逻辑输出到不同的log文件
- 我自己的Android面试试题总结整理
- tomcat最大线程数的设置