You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by du...@apache.org on 2021/05/23 13:39:59 UTC

[rocketmq] branch develop updated: [ISSUE #2783] fix_bug_in_ThreadLocalIndex

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

duhengforever 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 b78326d  [ISSUE #2783] fix_bug_in_ThreadLocalIndex
     new 2fb5f7a  Merge pull request #2785 from Kingdon1992/fix_bug_in_ThreadLocalIndex
b78326d is described below

commit b78326d869a09ed9f37b85dc957b39dff7a4ef87
Author: Kingdon1992 <wa...@qudian.com>
AuthorDate: Wed Apr 7 14:56:53 2021 +0800

    [ISSUE #2783] fix_bug_in_ThreadLocalIndex
---
 .../java/org/apache/rocketmq/client/common/ThreadLocalIndex.java     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/client/src/main/java/org/apache/rocketmq/client/common/ThreadLocalIndex.java b/client/src/main/java/org/apache/rocketmq/client/common/ThreadLocalIndex.java
index c0b04ca..891c17e 100644
--- a/client/src/main/java/org/apache/rocketmq/client/common/ThreadLocalIndex.java
+++ b/client/src/main/java/org/apache/rocketmq/client/common/ThreadLocalIndex.java
@@ -30,9 +30,8 @@ public class ThreadLocalIndex {
             this.threadLocalIndex.set(index);
         }
 
-        index = Math.abs(index + 1);
-        this.threadLocalIndex.set(index);
-        return index;
+        this.threadLocalIndex.set(++index);
+        return Math.abs(index);
     }
 
     @Override