Skip to content

Commit 2bc841b

Browse files
authored
Remove pure-java support (#381)
* Remove pure-java snappy support * Remove pure-java support description
1 parent cecbb0d commit 2bc841b

12 files changed

+3
-1294
lines changed

README.md

-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ snappy-java is a Java port of the [snappy](https://github.com/google/snappy), a
1313
* Compression/decompression of Java primitive arrays (`float[]`, `double[]`, `int[]`, `short[]`, `long[]`, etc.)
1414
* To improve the compression ratios of these arrays, you can use a fast data-rearrangement implementation ([`BitShuffle`](https://oss.sonatype.org/service/local/repositories/releases/archive/org/xerial/snappy/snappy-java/1.1.8/snappy-java-1.1.8-javadoc.jar/!/org/xerial/snappy/BitShuffle.html)) before compression
1515
* Portable across various operating systems; Snappy-java contains native libraries built for Window/Mac/Linux, etc. snappy-java loads one of these libraries according to your machine environment (It looks system properties, `os.name` and `os.arch`).
16-
* If no native library for your platform is found, snappy-java will fallback to [pure-java implementation](#using-pure-java-snappy-implementation).
1716
* Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in `org.xerial.snappy.Snappy`.
1817
* [Framing-format support](https://github.com/google/snappy/blob/master/framing_format.txt) (Since 1.1.0 version)
1918
* OSGi support
@@ -173,11 +172,6 @@ A file `target/snappy-java-$(version).jar` is the product additionally containin
173172

174173
## Miscellaneous Notes
175174

176-
### Using pure-java Snappy implementation
177-
178-
snappy-java can optionally use a pure-java implementation of Snappy based on [aircompressor](https://github.com/airlift/aircompressor/tree/master/src/main/java/io/airlift/compress/snappy). This implementation is selected when no native Snappy library for your platform is found. You can also force using this pure-java implementation by setting a JVM property `org.xerial.snappy.purejava=true` before loading any class of Snappy (e.g., using `-Dorg.xerial.snappy.purejava=true` option when launching JVM).
179-
180-
181175
### Using snappy-java with Tomcat 6 (or higher) Web Server
182176

183177
Simply put the snappy-java's jar to WEB-INF/lib folder of your web application. Usual JNI-library specific problem no longer exists since snappy-java version 1.0.3 or higher can be loaded by multiple class loaders.

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ enablePlugins(SbtOsgi)
7373

7474
osgiSettings
7575

76-
OsgiKeys.exportPackage := Seq("org.xerial.snappy", "org.xerial.snappy.buffer", "org.xerial.snappy.pool", "org.xerial.snappy.pure")
76+
OsgiKeys.exportPackage := Seq("org.xerial.snappy", "org.xerial.snappy.buffer", "org.xerial.snappy.pool")
7777
OsgiKeys.bundleSymbolicName := "org.xerial.snappy.snappy-java"
7878
OsgiKeys.bundleActivator := Option("org.xerial.snappy.SnappyBundleActivator")
7979
OsgiKeys.importPackage := Seq("""org.osgi.framework;version="[1.5,2)"""")

src/main/java/org/xerial/snappy/SnappyLoader.java

+2-20
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
//--------------------------------------
2525
package org.xerial.snappy;
2626

27-
import org.xerial.snappy.pure.PureJavaSnappy;
28-
2927
import java.io.*;
3028
import java.net.URL;
3129
import java.util.Enumeration;
@@ -149,29 +147,13 @@ private static void loadSnappySystemProperties()
149147
loadSnappySystemProperties();
150148
}
151149

152-
static synchronized boolean isPureJava() {
153-
return snappyApi != null && PureJavaSnappy.class.isAssignableFrom(snappyApi.getClass());
154-
}
155-
156150
static synchronized SnappyApi loadSnappyApi()
157151
{
158152
if (snappyApi != null) {
159153
return snappyApi;
160154
}
161-
try {
162-
if(Boolean.parseBoolean(System.getProperty(KEY_SNAPPY_PUREJAVA, "false"))) {
163-
// Use pure-java Snappy implementation
164-
setSnappyApi(new PureJavaSnappy());
165-
}
166-
else {
167-
loadNativeLibrary();
168-
setSnappyApi(new SnappyNative());
169-
}
170-
}
171-
catch(Throwable e) {
172-
// Fall-back to pure-java Snappy implementation
173-
setSnappyApi(new PureJavaSnappy());
174-
}
155+
loadNativeLibrary();
156+
setSnappyApi(new SnappyNative());
175157
return snappyApi;
176158
}
177159

src/main/java/org/xerial/snappy/pure/PureJavaSnappy.java

-309
This file was deleted.

0 commit comments

Comments
 (0)