merged
This commit is contained in:
commit
1354d90401
4
pom.xml
4
pom.xml
|
@ -63,8 +63,8 @@
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.0.2</version>
|
<version>2.0.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.5</source>
|
||||||
<target>1.6</target>
|
<target>1.5</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ import java.util.Properties;
|
||||||
* In default, no configuration is required to use snappy-java, but you can load
|
* In default, no configuration is required to use snappy-java, but you can load
|
||||||
* your own native library created by 'make native' command.
|
* your own native library created by 'make native' command.
|
||||||
*
|
*
|
||||||
* LoadSnappy searches for native libraries (snappyjava.dll, libsnappy.so, etc.)
|
* This SnappyLoader searches for native libraries (snappyjava.dll, libsnappy.so, etc.)
|
||||||
* in the following order:
|
* in the following order:
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>(System property: <i>org.xerial.snappy.lib.path</i>)/(System property:
|
* <li>(System property: <i>org.xerial.snappy.lib.path</i>)/(System property:
|
||||||
|
@ -132,7 +132,7 @@ public class SnappyLoader
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load SnappyNative and its JNI native implementation in the root class
|
* Load SnappyNative and its JNI native implementation in the root class
|
||||||
* loader. This is necessary to avoid the JNI multi-loading issue when the
|
* loader. This process is necessary to avoid the JNI multi-loading issue when the
|
||||||
* same JNI library is loaded by different class loaders in the same JVM.
|
* same JNI library is loaded by different class loaders in the same JVM.
|
||||||
*
|
*
|
||||||
* In order to load native code in the root class loader, this method first
|
* In order to load native code in the root class loader, this method first
|
||||||
|
@ -171,13 +171,14 @@ public class SnappyLoader
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!hasInjectedNativeLoader()) {
|
if (!hasInjectedNativeLoader()) {
|
||||||
// Prepare SnappyNativeLoader or LocalSnappyNativeLoader
|
// Inject SnappyNativeLoader (src/main/resources/org/xerial/snappy/SnappyNativeLoader.bytecode) to the root class loader
|
||||||
Class< ? > nativeLoader = injectSnappyNativeLoader();
|
Class< ? > nativeLoader = injectSnappyNativeLoader();
|
||||||
// Load the JNI code
|
// Load the JNI code using the injected loader
|
||||||
loadNativeLibrary(nativeLoader);
|
loadNativeLibrary(nativeLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
|
// Look up SnappyNative, injected to the root classloder, using reflection to order to avoid the initialization of SnappyNative class in this context class loader.
|
||||||
api = (SnappyNativeAPI) Class.forName("org.xerial.snappy.SnappyNative").newInstance();
|
api = (SnappyNativeAPI) Class.forName("org.xerial.snappy.SnappyNative").newInstance();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue