This is an automated email from the ASF dual-hosted git repository.

lizhanhui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4da7b1884 [ISSUE #6474]Optimize ServiceThread log print (#6475)
4da7b1884 is described below

commit 4da7b1884be23894672e8334c984bf3ca6938ac3
Author: mxsm <[email protected]>
AuthorDate: Mon Mar 27 13:13:23 2023 +0800

    [ISSUE #6474]Optimize ServiceThread log print (#6475)
---
 .../main/java/org/apache/rocketmq/common/ServiceThread.java   | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/common/src/main/java/org/apache/rocketmq/common/ServiceThread.java 
b/common/src/main/java/org/apache/rocketmq/common/ServiceThread.java
index bda95f01f..4b7da90df 100644
--- a/common/src/main/java/org/apache/rocketmq/common/ServiceThread.java
+++ b/common/src/main/java/org/apache/rocketmq/common/ServiceThread.java
@@ -18,6 +18,7 @@ package org.apache.rocketmq.common;
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+
 import org.apache.rocketmq.common.constant.LoggerName;
 import org.apache.rocketmq.logging.org.slf4j.Logger;
 import org.apache.rocketmq.logging.org.slf4j.LoggerFactory;
@@ -51,6 +52,7 @@ public abstract class ServiceThread implements Runnable {
         this.thread = new Thread(this, getServiceName());
         this.thread.setDaemon(isDaemon);
         this.thread.start();
+        log.info("Start service thread:{} started:{} lastThread:{}", 
getServiceName(), started.get(), thread);
     }
 
     public void shutdown() {
@@ -63,7 +65,7 @@ public abstract class ServiceThread implements Runnable {
             return;
         }
         this.stopped = true;
-        log.info("shutdown thread " + this.getServiceName() + " interrupt " + 
interrupt);
+        log.info("shutdown thread[{}] interrupt={} ", getServiceName(), 
interrupt);
 
         if (hasNotified.compareAndSet(false, true)) {
             waitPoint.countDown(); // notify
@@ -79,8 +81,7 @@ public abstract class ServiceThread implements Runnable {
                 this.thread.join(this.getJoinTime());
             }
             long elapsedTime = System.currentTimeMillis() - beginTime;
-            log.info("join thread " + this.getServiceName() + " elapsed 
time(ms) " + elapsedTime + " "
-                + this.getJoinTime());
+            log.info("join thread[{}], elapsed time: {}ms, join time:{}ms", 
getServiceName(), elapsedTime, this.getJoinTime());
         } catch (InterruptedException e) {
             log.error("Interrupted", e);
         }
@@ -101,7 +102,7 @@ public abstract class ServiceThread implements Runnable {
             return;
         }
         this.stopped = true;
-        log.info("stop thread " + this.getServiceName() + " interrupt " + 
interrupt);
+        log.info("stop thread[{}],interrupt={} ", this.getServiceName(), 
interrupt);
 
         if (hasNotified.compareAndSet(false, true)) {
             waitPoint.countDown(); // notify
@@ -117,7 +118,7 @@ public abstract class ServiceThread implements Runnable {
             return;
         }
         this.stopped = true;
-        log.info("makestop thread " + this.getServiceName());
+        log.info("makestop thread[{}] ", this.getServiceName());
     }
 
     public void wakeup() {

Reply via email to