wu-sheng commented on a change in pull request #6232:
URL: https://github.com/apache/skywalking/pull/6232#discussion_r560827114



##########
File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java
##########
@@ -114,4 +113,26 @@ public void forceSampled() {
     private void resetSamplingFactor() {
         samplingFactorHolder = new AtomicInteger(0);
     }
+
+    /**
+     * Reset scheduledFuture to support samplingRate changed.
+     */
+    void resetScheduledFuture() {
+        if (scheduledFuture != null) {
+            scheduledFuture.cancel(true);
+        }
+        on = false;
+        if (samplingRateWatcher.getSamplingRate() > 0) {

Review comment:
       You are still checking and reading this number repeatedly. Add `boolean 
shouldSampling` to the `samplingRateWatcher`




----------------------------------------------------------------
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]


Reply via email to