[
https://issues.apache.org/jira/browse/ROCKETMQ-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16024605#comment-16024605
]
ASF subversion and git services commented on ROCKETMQ-39:
---------------------------------------------------------
Commit c0fe02e1c6a0afd516c1323c8b5808fd7ddad72e in incubator-rocketmq's branch
refs/heads/develop from wu-sheng
[ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=c0fe02e ]
[ROCKETMQ-39] avoid duplicated codes closes apache/incubator-rocketmq#34
> Duplicated codes in both filtersrv and namesrv modules
> ------------------------------------------------------
>
> Key: ROCKETMQ-39
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-39
> Project: Apache RocketMQ
> Issue Type: Improvement
> Components: rocketmq-namesrv
> Reporter: Wu Sheng
> Assignee: Xiaorui Wang
> Priority: Minor
> Fix For: 4.1.0-incubating
>
>
> In FiltersrvStartup.class and NamesrvStartup.class, exist the exact same code
> about add jvm shutdown hook, and execute somthing on shutting down.
> Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
> private volatile boolean hasShutdown = false;
> private AtomicInteger shutdownTimes = new AtomicInteger(0);
> @Override
> public void run() {
> synchronized (this) {
> log.info("shutdown hook was invoked, " +
> this.shutdownTimes.incrementAndGet());
> if (!this.hasShutdown) {
> this.hasShutdown = true;
> long begineTime = System.currentTimeMillis();
> controller.shutdown();
> long consumingTimeTotal =
> System.currentTimeMillis() - begineTime;
> log.info("shutdown hook over, consuming time
> total(ms): " + consumingTimeTotal);
> }
> }
> }
> }, "ShutdownHook"));
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)