mirror of
https://github.com/xerial/snappy-java.git
synced 2025-04-08 19:35:08 +02:00
fix
This commit is contained in:
parent
331e7ef10b
commit
94b879fe12
@ -37,7 +37,7 @@ import java.security.DigestInputStream;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@ -186,8 +186,7 @@ public class SnappyLoader
|
|||||||
try {
|
try {
|
||||||
if (!useNativeCodeInjection) {
|
if (!useNativeCodeInjection) {
|
||||||
// Use the local loader
|
// Use the local loader
|
||||||
return Thread.currentThread().getContextClassLoader()
|
return LocalSnappyNativeLoader.class;
|
||||||
.loadClass(LocalSnappyNativeLoader.class.getName());
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Use parent class loader to load SnappyNative, since Tomcat, which uses different class loaders for each webapps, cannot load JNI interface twice
|
// Use parent class loader to load SnappyNative, since Tomcat, which uses different class loaders for each webapps, cannot load JNI interface twice
|
||||||
@ -267,16 +266,16 @@ public class SnappyLoader
|
|||||||
private static class LocalSnappyNativeLoader
|
private static class LocalSnappyNativeLoader
|
||||||
{
|
{
|
||||||
// preserved for LocalSnappyNativeLoader
|
// preserved for LocalSnappyNativeLoader
|
||||||
private static HashMap<String, Boolean> loadedLibFiles = new HashMap<String, Boolean>();
|
private static HashSet<String> loadedLibFiles = new HashSet<String>();
|
||||||
private static HashMap<String, Boolean> loadedLib = new HashMap<String, Boolean>();
|
private static HashSet<String> loadedLib = new HashSet<String>();
|
||||||
|
|
||||||
public static synchronized void load(String lib) {
|
public static synchronized void load(String lib) {
|
||||||
if (loadedLibFiles.containsKey(lib))
|
if (loadedLibFiles.contains(lib))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.load(lib);
|
System.load(lib);
|
||||||
loadedLibFiles.put(lib, true);
|
loadedLibFiles.add(lib);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -284,12 +283,12 @@ public class SnappyLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static synchronized void loadLibrary(String libname) {
|
public static synchronized void loadLibrary(String libname) {
|
||||||
if (loadedLib.containsKey(libname))
|
if (loadedLib.contains(libname))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
System.loadLibrary(libname);
|
System.loadLibrary(libname);
|
||||||
loadedLib.put(libname, true);
|
loadedLib.add(libname);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user