Skip to content

Add option to disable fallback to PureJavaSnappy #326

@lehnerj

Description

@lehnerj

snappy-java has two implementations of Snappy, one native implementation written in C/C++ and one written in Java called PureJavaSnappy.
At the moment the consumers of snappy-java cannot force to use the native implementation as snappy-java always falls back to PureJavaSnappy in case of any errors during loading of the native library. This is unfortunate not only because it limits the choices of the consumer but also because different people have reported issues with PureJavaSnappy, most notably #295.

The fallback to PureJavaSnappy was implemented with #244

static synchronized SnappyApi loadSnappyApi() {
...
        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());
        }
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions