luoxn28 opened a new issue #734: CommitLog.putMessage setStoreTimestamp 
repetition
URL: https://github.com/apache/rocketmq/issues/734
 
 
   
进入CommitLog.putMessage方法时,会先执行setStoreTimestamp设置时间戳,后面在对putMessageLock加锁后还会执行setStoreTimestamp设置时间戳,后者保证全局消息时间戳的顺序性,从流程来看,前者没必要设置。
   ```java
   public PutMessageResult putMessage(final MessageExtBrokerInner msg) {
        // Set the storage time
        msg.setStoreTimestamp(System.currentTimeMillis());
        // ...省略部分代码
   
        putMessageLock.lock(); //spin or ReentrantLock ,depending on store 
config
        try {
                long beginLockTimestamp = 
this.defaultMessageStore.getSystemClock().now();
                this.beginTimeInLock = beginLockTimestamp;
   
                // Here settings are stored timestamp, in order to ensure an 
orderly
                // global
                msg.setStoreTimestamp(beginLockTimestamp);
   
                // ...省略部分代码
   
        return putMessageResult;
   }
   ```

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


With regards,
Apache Git Services

Reply via email to