You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/11 02:36:59 UTC

[jira] [Commented] (ROCKETMQ-39) Duplicated codes in both filtersrv and namesrv modules

    [ https://issues.apache.org/jira/browse/ROCKETMQ-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15816925#comment-15816925 ] 

ASF GitHub Bot commented on ROCKETMQ-39:
----------------------------------------

GitHub user wu-sheng opened a pull request:

    https://github.com/apache/incubator-rocketmq/pull/34

    fix/ROCKETMQ-39: avoid duplicated codes.

    ref issue: https://issues.apache.org/jira/browse/ROCKETMQ-39

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/wu-sheng/incubator-rocketmq fix/ROCKETMQ-39

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-rocketmq/pull/34.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #34
    
----
commit 02a2d0eab3c5ffccd74a2226ed0d5b59509c3d21
Author: wusheng <wu...@foxmail.com>
Date:   2017-01-11T02:34:18Z

    fix/ROCKETMQ-39: avoid duplicated codes.

----


> 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
>
> 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.4#6332)