From d61469c0b2a356a886404cbf22767ef07048facf Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 5 May 2022 21:26:15 +0100 Subject: Ignore "inactive" error when stopping the async profiler (#191) --- .../java/me/lucko/spark/common/sampler/async/AsyncSampler.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'spark-common/src') diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java index 60c4e03..5cb7fdc 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncSampler.java @@ -144,7 +144,14 @@ public class AsyncSampler extends AbstractSampler { */ @Override public void stop() { - this.profiler.stop(); + try { + this.profiler.stop(); + } catch (IllegalStateException e) { + if (!e.getMessage().equals("Profiler is not active")) { // ignore + throw e; + } + } + if (this.timeoutExecutor != null) { this.timeoutExecutor.shutdown(); -- cgit