Spring webapp - shutting down threads on Application stop
显示使用线程池Executors,必须执行 pool.shutdown() 否则会存在线程池泄露;
http://stackoverflow.com/questions/22650569/spring-webapp-shutting-down-threads-on-application-stop
|
I am instantiating a ScheduledExecutorService using Spring's ApplicationListener interface as follows:
At the moment, Tomcat won't shut down cleanly when I run, ./shutdown.sh, with message:
and this seems to be because I have not yet written code to stop the ScheduledExecutorService. My question is: how should this be done properly in this environment? I noticed that there exists a ContextStoppedEvent, so, I implemented a listener for it:
But it seems that this event handler doesn't get called when Tomcat is shutdown. Have I implemented this incorrectly, or am I going about this completely the wong way? |
|||
|
You're looking for
When the Servlet container shuts down, it calls |
|||||||||
|
Spring webapp - shutting down threads on Application stop的更多相关文章
- [Spring Boot] Set Context path for application in application.properties
If you were using Microservice with Spring Boot to build different REST API endpoints, context path ...
- spring boot中的底层配置文件application.yam(application.property)的装配原理初探
*在spring boot中有一个基础的配置文件application.yam(application.property)用于对spring boot的默认设置做一些改动. *在spring boot ...
- Spring JTA应用JOTM & Atomikos I Application
关于Spring JTA的介绍非常多了,这里就不再一再阐述其优越性怎么怎么了,直接开始正题.一个大致的需求如下,用户在进行增删改操作时,会同时更新2至3个数据库的数据表,操作需要事务来包裹,以便在操作 ...
- mvn+spring+webapp模板
idea新建项目,选择maven-archetype-webapp 在main目录下创建java resource 文件夹,赋予特殊文件夹 pom.xml 添加 <!--Spring框架核心库 ...
- Spring系列之——springboot解析resources.application.properties文件
摘要:本文通过讲解如何解析application.properties属性,介绍了几个注解的运用@Value @ConfigurationProperties @EnableConfiguration ...
- spring webapp的配置文件放置在项目外的方法
在web.xml中,填写 <context-param> <param-name>CFG_HOME</param-name> ...
- spring boot application.properties 属性详解
2019年3月21日17:09:59 英文原版: https://docs.spring.io/spring-boot/docs/current/reference/html/common-appli ...
- spring boot application.properties详解
附上最新文档地址:https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-propertie ...
- Spring boot 全局配置文件application.properties
#更改Tomcat端口号 server.port=8090 #修改进入DispatcherServlet的规则为:*.htmlserver.servlet-path=*.html#这里要注意高版本的s ...
随机推荐
- CentOS7 增加tomcat 启动,停止,使用systemctl进行配置
1,centos7 使用 systemctl 替换了 service命令 参考:redhat文档: https://access.redhat.com/documentation/en-US/Red_ ...
- Linux 系统目录结构
登录系统后,在当前命令窗口下输入命令: ls / 你会看到如下图所示: 树状目录结构: 以下是对这些目录的解释: /bin: bin是Binary的缩写, 这个目录存放着最经常使用的命令. /boot ...
- AWS EC2的VPN-PPTP搭建教程(on aws redhat6.5 X64 centOS 6.5)
前些日子收到amazon的邮件通知,一年前申请的ec2到期了,一年免费的free tier没有了,放在上面的2个站已经欠费了十几美元了,不过我也不打算用了,准备重新注册账号(请不要鄙视我..) 1.注 ...
- 0517 Scrum 项目4.0
Sprint 1看板: 任务认领(一种标签颜色代表一个人的任务): 许佳仪:紫色 柯晓君:红色 赖文亮:蓝色 卓宇靖:黑色 每日例会的时间:16:00 地点:课室 成员 团队贡献分 许佳仪 1 ...
- PDF解析
解析如下图PDF文件 using System; using System.Collections.Generic; using System.Linq; using System.Text; usi ...
- ASP.NET中的Session怎么正确使用[转]
Session对象用于存储从一个用户开始访问某个特定的aspx的页面起,到用户离开为止,特定的用户会话所需要的信息.用户在应用程序的页面切换时,Session对象的变量不会被清除. 对于一个Web应用 ...
- 做办公用品、文具方面的 B2C 是否有前景呢?
企乐买现在正在做这方面的事,从市场角度来说需求是有的,客单价和重复购买率都还可以,但是也存在几个致命问题使得施展不开举步维艰: 1.中国特有的市场环境:在美国企业办公用品一般都是网上采购,避免灰色的东 ...
- 一些iOS心得
ARC 1,arc是什么? automatic referece counting mrc mannualiOS5 之后出来的技术// 2,arc的原理是什么?// 在程序编译的时候,系统帮我 ...
- 查找SAP标准程序用户出口及BADI的方法
查找SAP标准事务代码中使用的BADI: 在SE24中,查看类对象CL_EXITHANDLER,在其方法(Methods)GET_INSTANCE 的第14行打断点,之后运行事务代码: 当有BADI将 ...
- SQL同列合并
SELECT cast(id as varchar(8)) new_id FROM tourol_Atractions where tcid>0 order by new_id SELECT t ...

