글
프로젝트를 진행하다보면 톰켓 shutdown을 실행시켜서 당연히 종료되었다고 생각했지만 제대로 종료되지않고 톰캣 프로세스가 남아있는 현상이 있습니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
import java.io.IOException;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Date;
import java.util.Enumeration;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.Level;
import org.quartz.Scheduler;
public class ShutdownHook implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent arg0)
{
try
{
// 스케쥴러 Bean name을 모를때 주석을 풀어 Bean Name을 찾을 수 있다.
// String[] temp = getBzRConfigHelper().getFactory().getBeanDefinitionNames();
// if(temp!=null) {
// for (int i = 0; i < temp.length; i++) {
// this.logHandler("beans : " + temp[i], null);
// }
// }
// Get a reference to the Scheduler and shut it down
try {
Scheduler scheduler = (Scheduler) getBzRConfigHelper().getFactory().getBean("org.springframework.scheduling.quartz.SchedulerFactoryBean");
scheduler.shutdown(true);
}catch(NoSuchBeanDefinitionException e) {
this.logHandler(e.getMessage(), e);
}
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
try {
DriverManager.deregisterDriver(driver);
this.logHandler(String.format("deregistering jdbc driver: %s", driver), null);
} catch (SQLException e) {
this.logHandler(String.format("deregistering jdbc driver: %s", driver), e);
}
}
Thread.sleep(1000);
try {
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
threadGroup.interrupt();
}catch(Exception e) {
this.logHandler(e.getMessage(), e);
}
this.logHandler("--End contextDestroyed --" + new Date(), null);
// Sleep for a bit so that we don't get any errors
}
catch (Exception e)
{
e.printStackTrace();
}
}
@Override
public void contextInitialized(ServletContextEvent arg0)
{
}
public boolean isNullOrEmpty(String str) {
return str == null || StringUtils.isEmpty(str);
}
public boolean isNullOrEmptyOrWhite(String str) {
return str == null || StringUtils.isEmpty(str.trim());
}
}
http://colorscripter.com/info#e" target="_blank" style="color: rgb(229, 229, 229);">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="color: white;">cs |
1
2
3
4
5
|
....
<listener>
<!-- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> -->
</listener>
http://colorscripter.com/info#e" target="_blank" style="color: rgb(229, 229, 229);">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="color: white;">cs |
'Java > Error해결' 카테고리의 다른 글
JAVA AES256 암호화 시 java.security.InvalidKeyException: Illegal key size 오류 해결법 (0) | 2018.03.09 |
---|
RECENT COMMENT