rocketmq
rocketmq copied to clipboard
CommitLog.putMessage setStoreTimestamp repetition
进入CommitLog.putMessage方法时,会先执行setStoreTimestamp设置时间戳,后面在对putMessageLock加锁后还会执行setStoreTimestamp设置时间戳,后者保证全局消息时间戳的顺序性,从流程来看,前者没必要设置。
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 issue is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs.
This issue was closed because it has been inactive for 3 days since being marked as stale.