From 111e52f3347e7ebec7bcca8a1cd185b2900753de Mon Sep 17 00:00:00 2001 From: Luck Date: Fri, 30 Jul 2021 18:53:45 +0100 Subject: Catch UnsatisfiedLinkError when loading async-profiler native lib --- .../me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'spark-common/src/main/java/me/lucko/spark/common/sampler') diff --git a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java index 50e97aa..cf9572a 100644 --- a/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java +++ b/spark-common/src/main/java/me/lucko/spark/common/sampler/async/AsyncProfilerAccess.java @@ -66,7 +66,11 @@ public final class AsyncProfilerAccess { } // get an instance of async-profiler - return AsyncProfiler.getInstance(extractPath.toAbsolutePath().toString()); + try { + return AsyncProfiler.getInstance(extractPath.toAbsolutePath().toString()); + } catch (UnsatisfiedLinkError e) { + throw new RuntimeException("A runtime error occurred whilst loading the native library", e); + } } /** An instance of the async-profiler Java API. */ -- cgit