Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
2e5d8dce
Commit
2e5d8dce
authored
Jan 30, 2021
by
房斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1解决dubbo tomcat 加载类的判断。没有使用不加载 2执行顺序 tomcat优先dubbo 停机
parent
bcec9771
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
TomcatGracefullyShutDown.java
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/service/TomcatGracefullyShutDown.java
+57
-0
No files found.
matrix-gracefulshutdown/src/main/java/com/secoo/mall/dubbo/service/TomcatGracefullyShutDown.java
0 → 100644
View file @
2e5d8dce
package
com
.
secoo
.
mall
.
dubbo
.
service
;
import
com.secoo.mall.dubbo.service.impl.TomcatConnectShoutDownHock
;
import
org.apache.catalina.connector.Connector
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeansException
;
import
org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.event.ContextClosedEvent
;
import
org.springframework.core.Ordered
;
public
class
TomcatGracefullyShutDown
implements
TomcatConnectorCustomizer
,
ApplicationContextAware
,
Ordered
,
ApplicationListener
<
ContextClosedEvent
>
{
private
ApplicationContext
context
;
TomcatConnectShoutDownHock
tomcatConnectShoutDownHock
;
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
public
TomcatGracefullyShutDown
(
TomcatConnectShoutDownHock
tomcatConnectShoutDownHock
)
{
this
.
tomcatConnectShoutDownHock
=
tomcatConnectShoutDownHock
;
}
@Override
public
void
customize
(
Connector
connector
)
{
tomcatConnectShoutDownHock
.
setConnector
(
connector
);
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
this
.
context
=
applicationContext
;
logger
.
info
(
"11111111111111111111 setContext"
);
}
public
TomcatConnectShoutDownHock
getTomcatConnectShoutDownHock
()
{
return
tomcatConnectShoutDownHock
;
}
public
void
setTomcatConnectShoutDownHock
(
TomcatConnectShoutDownHock
tomcatConnectShoutDownHock
)
{
this
.
tomcatConnectShoutDownHock
=
tomcatConnectShoutDownHock
;
}
@Override
public
int
getOrder
()
{
return
1
;
}
@Override
public
void
onApplicationEvent
(
ContextClosedEvent
contextClosedEvent
)
{
logger
.
info
(
"11111111111111111111 "
);
tomcatConnectShoutDownHock
.
stop
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment