public boolean shouldSample(String service, int sample, int duration) {
        SamplingPolicy samplingPolicy = this.samplingPolicySettings.get().get(service);
        if (samplingPolicy == null) {
            return shouldSampleByDefault(sample, duration);
        }
        return shouldSampleService(samplingPolicy, sample, duration);
    }
@Test
    @Timeout(20)
    public void testDefaultSampleRateDynamicUpdate() throws InterruptedException {
        ConfigWatcherRegister register = new DefaultSampleRateMockConfigWatcherRegister(3);

        TraceSamplingPolicyWatcher watcher = new TraceSamplingPolicyWatcher(moduleConfig, provider);
        register.registerConfigChangeWatcher(watcher);
        register.start();
        // Default is 10000, so 9000 must be sampled,until updating to 9000
        while (watcher.shouldSample("", 9000, -1)) {
            Thread.sleep(2000);
        }
        globalDefaultSamplingRateEquals(watcher, 8999);
    }