lazyfighter opened a new issue #1310: Can we optimize SystemLock just like 
alibaba/sentinel-core
URL: https://github.com/apache/rocketmq/issues/1310
 
 
   ```java
   public class SystemClock {
       public long now() {
           return System.currentTimeMillis();
       }
   }
   
   
   public final class TimeUtil {
   
       private static volatile long currentTimeMillis;
   
       static {
           currentTimeMillis = System.currentTimeMillis();
           Thread daemon = new Thread(new Runnable() {
               @Override
               public void run() {
                   while (true) {
                       currentTimeMillis = System.currentTimeMillis();
                       try {
                           TimeUnit.MILLISECONDS.sleep(1);
                       } catch (Throwable e) {
   
                       }
                   }
               }
           });
           daemon.setDaemon(true);
           daemon.setName("sentinel-time-tick-thread");
           daemon.start();
       }
   
       public static long currentTimeMillis() {
           return currentTimeMillis;
       }
   }
   
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to