From b2bfd0f23a38bebafe51289d754cd0cd28e100b6 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Fri, 27 Sep 2024 00:18:13 +0200 Subject: [PATCH] Load zstd before rocksdb --- .../core/impl/rocksdb/RocksDBLoader.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/RocksDBLoader.java b/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/RocksDBLoader.java index b151042..474329e 100644 --- a/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/RocksDBLoader.java +++ b/src/main/java/it/cavallium/rockserver/core/impl/rocksdb/RocksDBLoader.java @@ -43,18 +43,6 @@ public class RocksDBLoader { private static final String bugFallbackJniLibraryFileName = Environment.getFallbackJniLibraryFileName("rocksdbjni"); public static void loadLibrary() { - try { - String currentUsersHomeDir = System.getProperty("user.home"); - var jniPath = Path.of(currentUsersHomeDir).resolve(".jni").resolve("rocksdb").resolve(RocksDBMetadata.getRocksDBVersionHash()); - if (Files.notExists(jniPath)) { - Files.createDirectories(jniPath); - } - loadLibraryFromJarToTemp(jniPath); - - RocksDB.loadLibrary(List.of(jniPath.toAbsolutePath().toString())); - } catch (IOException e) { - RocksDB.loadLibrary(); - } for (final CompressionType compressionType : CompressionType.values()) { try { if (compressionType.getLibraryName() != null) { @@ -67,6 +55,18 @@ public class RocksDBLoader { // since it may be optional, we ignore its loading failure here. } } + try { + String currentUsersHomeDir = System.getProperty("user.home"); + var jniPath = Path.of(currentUsersHomeDir).resolve(".jni").resolve("rocksdb").resolve(RocksDBMetadata.getRocksDBVersionHash()); + if (Files.notExists(jniPath)) { + Files.createDirectories(jniPath); + } + loadLibraryFromJarToTemp(jniPath); + + RocksDB.loadLibrary(List.of(jniPath.toAbsolutePath().toString())); + } catch (IOException e) { + RocksDB.loadLibrary(); + } } private static Path loadLibraryFromJarToTemp(final Path tmpDir) throws IOException {