diff --git a/src/main/java/org/xerial/snappy/SnappyLoader.java b/src/main/java/org/xerial/snappy/SnappyLoader.java index f802183..bf4c9e8 100755 --- a/src/main/java/org/xerial/snappy/SnappyLoader.java +++ b/src/main/java/org/xerial/snappy/SnappyLoader.java @@ -112,7 +112,7 @@ public class SnappyLoader return isLoaded; } - static SnappyNativeAPI load() { + static synchronized SnappyNativeAPI load() { if (isInitialized) return api; diff --git a/src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode b/src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode index 93bdcce..64c0fe8 100755 Binary files a/src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode and b/src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode differ diff --git a/src/main/resources/org/xerial/snappy/SnappyNativeLoader.java b/src/main/resources/org/xerial/snappy/SnappyNativeLoader.java index 1883166..967912c 100755 --- a/src/main/resources/org/xerial/snappy/SnappyNativeLoader.java +++ b/src/main/resources/org/xerial/snappy/SnappyNativeLoader.java @@ -31,7 +31,7 @@ public class SnappyNativeLoader private static HashMap loadedLibFiles = new HashMap(); private static HashMap loadedLib = new HashMap(); - public static void load(String lib) { + public static synchronized void load(String lib) { if (loadedLibFiles.containsKey(lib) && loadedLibFiles.get(lib) == true) return; @@ -44,7 +44,7 @@ public class SnappyNativeLoader } } - public static void loadLibrary(String libname) { + public static synchronized void loadLibrary(String libname) { if (loadedLib.containsKey(libname) && loadedLib.get(libname) == true) return;