From 09b979c5af374a548b9ccbc4a6f08801bbce38bf Mon Sep 17 00:00:00 2001 From: wu-sheng Date: Tue, 19 Dec 2017 15:27:14 +0800 Subject: [PATCH] Fix npe --- .../skywalking/apm/agent/core/sampling/SamplingService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java index 15d831427..e2910bba6 100644 --- a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java +++ b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/sampling/SamplingService.java @@ -26,10 +26,10 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.skywalking.apm.agent.core.boot.BootService; import org.apache.skywalking.apm.agent.core.boot.DefaultNamedThreadFactory; +import org.apache.skywalking.apm.agent.core.conf.Config; import org.apache.skywalking.apm.agent.core.context.trace.TraceSegment; import org.apache.skywalking.apm.agent.core.logging.api.ILog; import org.apache.skywalking.apm.agent.core.logging.api.LogManager; -import org.apache.skywalking.apm.agent.core.conf.Config; /** * The SamplingService take charge of how to sample the {@link TraceSegment}. Every {@link TraceSegment}s @@ -83,7 +83,9 @@ public class SamplingService implements BootService { @Override public void shutdown() throws Throwable { - scheduledFuture.cancel(true); + if (scheduledFuture != null) { + scheduledFuture.cancel(true); + } } /**