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 ...
随机推荐
- HTTP状态码及其含义
下表显示了常见的HTTP 1.1状态代码以及它们对应的状态信息和含义.应当谨慎地使用那些只有HTTP 1.1支持的状态代码,因为许多浏览器还只能够支持HTTP 1.0.如果你使用了HTTP 1.1特有 ...
- mac os 中类似于Linux的yum工具,或ubuntu的apt-get工具Homebrew
Linux下的yum用着真省心! mac下的相类似的软件是Homebrew 使用前需要先安装它, ruby -e "$(curl -fsSL https://raw.githubuserco ...
- [双连通分量] POJ 3177 Redundant Paths
Redundant Paths Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13712 Accepted: 5821 ...
- transform scale
- CSS样式选择器优先级
CSS样式选择器分为4个等级,a.b.c.d,可以以这四种等级为依据确定CSS选择器的优先级. 1.如果样式是行内样式(通过Style=””定义),那么a=12.b为ID选择器的总数3.c为Class ...
- php一个简单的计算器
<?php if(isset($_POST['sub'])) { $result = ''; switch($_POST['ysf']) { case '+': $result = $_POST ...
- .net 获取AppDomain创建了多少
partial class HttpBrowser { public static string IsolateCall(PageContentHandler pHandler) { Contract ...
- Python 中下划线
1. 作为一个名称:在代码中使用一个名称,但是在后面的代码中不再会使用到的时候,就可以使用_作为临时名称. n = 42 for _ in range(n): do_something() 2. 名称 ...
- Java xml object 互转
public class ClassRoom { private int id; private String name; private int grade; public int getId() ...
- sqoop连接oracle与mysql&mariadb的错误
错误说明: 由于我的hadoop的集群是用cloudera manager在线自动安装的,因此他们的安装路径必须遵循cloudera的规则,这里只有查看cloudera的官方文档了,请参考:http: ...

