wu-sheng commented on a change in pull request #6009:
URL: https://github.com/apache/skywalking/pull/6009#discussion_r543151563
##########
File path:
apm-commons/apm-datacarrier/src/main/java/org/apache/skywalking/apm/commons/datacarrier/partition/SimpleRollingPartitioner.java
##########
@@ -18,16 +18,18 @@
package org.apache.skywalking.apm.commons.datacarrier.partition;
+import java.util.concurrent.atomic.AtomicInteger;
+
/**
* use normal int to rolling.
*/
public class SimpleRollingPartitioner<T> implements IDataPartitioner<T> {
- @SuppressWarnings("NonAtomicVolatileUpdate")
- private volatile int i = 0;
+
+ private final AtomicInteger i = new AtomicInteger();
Review comment:
Let's talk about this. I know your point of bug, it would not increase
every time. But it has higher performance with no lock, in the partition, there
is a lock to avoid the real issue. So this is actually not a bug in the real
world.
This is another typical thing, codes are not by the book.
----------------------------------------------------------------
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]