forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Snappy to be loaded from a shared classloader
This commit introduces a solution for loading the Snappy native library across multiple test profiles. Due to the constraint that native libraries can only be loaded from a single classloader, a shared classloader is now utilized for loading Snappy in test mode. Please note, this feature is exclusively applicable when running tests. Fixes: quarkusio#39767
- Loading branch information
1 parent
20f148b
commit 3ffe398
Showing
4 changed files
with
56 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/SnappyLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.quarkus.kafka.client.runtime; | ||
|
||
import java.io.File; | ||
|
||
public class SnappyLoader { | ||
|
||
/* | ||
* This class is intended to be loaded from a shared classloader (e.g., the system classloader) to avoid | ||
* unsatisfied link errors when the native library is loaded from a different classloader. | ||
* See https://github.com/quarkusio/quarkus/issues/39767. | ||
* | ||
* This class is only used in tests if the `quarkus.kafka.snappy.load-from-shared-classloader=true` is set. | ||
*/ | ||
static { | ||
File out = SnappyRecorder.getLibraryFile(); | ||
System.load(out.getAbsolutePath()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters