Uploaded image for project: 'Apache RocketMQ'
  1. Apache RocketMQ
  2. ROCKETMQ-39

Duplicated codes in both filtersrv and namesrv modules

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.0-incubating
    • Component/s: rocketmq-namesrv
    • Labels:
      None

      Description

      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"));

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                vintagewang Xiaorui Wang
                Reporter:
                wu-sheng Sheng Wu
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: