Skip to content

Commit

Permalink
Remove pure-java support (#381)
Browse files Browse the repository at this point in the history
* Remove pure-java snappy support

* Remove pure-java support description
  • Loading branch information
xerial authored Jan 28, 2023
1 parent cecbb0d commit 2bc841b
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 1,294 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ snappy-java is a Java port of the [snappy](https://github.com/google/snappy), a
* Compression/decompression of Java primitive arrays (`float[]`, `double[]`, `int[]`, `short[]`, `long[]`, etc.)
* 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
* 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`).
* If no native library for your platform is found, snappy-java will fallback to [pure-java implementation](#using-pure-java-snappy-implementation).
* Simple usage. Add the snappy-java-(version).jar file to your classpath. Then call compression/decompression methods in `org.xerial.snappy.Snappy`.
* [Framing-format support](https://github.com/google/snappy/blob/master/framing_format.txt) (Since 1.1.0 version)
* OSGi support
Expand Down Expand Up @@ -173,11 +172,6 @@ A file `target/snappy-java-$(version).jar` is the product additionally containin

## Miscellaneous Notes

### Using pure-java Snappy implementation

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).


### Using snappy-java with Tomcat 6 (or higher) Web Server

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.
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ enablePlugins(SbtOsgi)

osgiSettings

OsgiKeys.exportPackage := Seq("org.xerial.snappy", "org.xerial.snappy.buffer", "org.xerial.snappy.pool", "org.xerial.snappy.pure")
OsgiKeys.exportPackage := Seq("org.xerial.snappy", "org.xerial.snappy.buffer", "org.xerial.snappy.pool")
OsgiKeys.bundleSymbolicName := "org.xerial.snappy.snappy-java"
OsgiKeys.bundleActivator := Option("org.xerial.snappy.SnappyBundleActivator")
OsgiKeys.importPackage := Seq("""org.osgi.framework;version="[1.5,2)"""")
Expand Down
22 changes: 2 additions & 20 deletions src/main/java/org/xerial/snappy/SnappyLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
//--------------------------------------
package org.xerial.snappy;

import org.xerial.snappy.pure.PureJavaSnappy;

import java.io.*;
import java.net.URL;
import java.util.Enumeration;
Expand Down Expand Up @@ -149,29 +147,13 @@ private static void loadSnappySystemProperties()
loadSnappySystemProperties();
}

static synchronized boolean isPureJava() {
return snappyApi != null && PureJavaSnappy.class.isAssignableFrom(snappyApi.getClass());
}

static synchronized SnappyApi loadSnappyApi()
{
if (snappyApi != null) {
return snappyApi;
}
try {
if(Boolean.parseBoolean(System.getProperty(KEY_SNAPPY_PUREJAVA, "false"))) {
// Use pure-java Snappy implementation
setSnappyApi(new PureJavaSnappy());
}
else {
loadNativeLibrary();
setSnappyApi(new SnappyNative());
}
}
catch(Throwable e) {
// Fall-back to pure-java Snappy implementation
setSnappyApi(new PureJavaSnappy());
}
loadNativeLibrary();
setSnappyApi(new SnappyNative());
return snappyApi;
}

Expand Down
309 changes: 0 additions & 309 deletions src/main/java/org/xerial/snappy/pure/PureJavaSnappy.java

This file was deleted.

Loading

0 comments on commit 2bc841b

Please sign in to comment.