merged
This commit is contained in:
commit
5d012b512f
|
@ -112,7 +112,7 @@ public class SnappyLoader
|
||||||
return isLoaded;
|
return isLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SnappyNativeAPI load() {
|
static synchronized SnappyNativeAPI load() {
|
||||||
|
|
||||||
if (isInitialized)
|
if (isInitialized)
|
||||||
return api;
|
return api;
|
||||||
|
@ -194,7 +194,7 @@ public class SnappyLoader
|
||||||
throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, ee.getMessage());
|
throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, ee.getMessage());
|
||||||
}
|
}
|
||||||
catch (Exception e2) {
|
catch (Exception e2) {
|
||||||
throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, e.getMessage());
|
throw new SnappyError(SnappyErrorCode.FAILED_TO_LOAD_NATIVE_LIBRARY, e2.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
Binary file not shown.
|
@ -31,7 +31,7 @@ public class SnappyNativeLoader
|
||||||
private static HashMap<String, Boolean> loadedLibFiles = new HashMap<String, Boolean>();
|
private static HashMap<String, Boolean> loadedLibFiles = new HashMap<String, Boolean>();
|
||||||
private static HashMap<String, Boolean> loadedLib = new HashMap<String, Boolean>();
|
private static HashMap<String, Boolean> loadedLib = new HashMap<String, Boolean>();
|
||||||
|
|
||||||
public static void load(String lib) {
|
public static synchronized void load(String lib) {
|
||||||
if (loadedLibFiles.containsKey(lib) && loadedLibFiles.get(lib) == true)
|
if (loadedLibFiles.containsKey(lib) && loadedLibFiles.get(lib) == true)
|
||||||
return;
|
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)
|
if (loadedLib.containsKey(libname) && loadedLib.get(libname) == true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,13 @@ public class SnappyLoaderTest
|
||||||
ClassLoader parent = this.getClass().getClassLoader().getParent();
|
ClassLoader parent = this.getClass().getClassLoader().getParent();
|
||||||
ClassWorld cw = new ClassWorld();
|
ClassWorld cw = new ClassWorld();
|
||||||
ClassRealm P = cw.newRealm("P", parent);
|
ClassRealm P = cw.newRealm("P", parent);
|
||||||
|
try {
|
||||||
|
P.loadClass("org.xerial.snappy.Snappy");
|
||||||
|
fail("org.xerial.snappy.Snappy is found in the parent");
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException e) {
|
||||||
|
// OK
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare the child class loaders which can load Snappy.class
|
// Prepare the child class loaders which can load Snappy.class
|
||||||
URL classPath = new File("target/classes").toURI().toURL();
|
URL classPath = new File("target/classes").toURI().toURL();
|
||||||
|
|
Loading…
Reference in New Issue