/** * Clean up a temporary file (native lib) generated by snappy-java. * General users do not need to call this method, since the native library extracted in snappy-java * is deleted upon JVM termination (vie deleteOnExit()). * This method is useful when using a J2EE container, which will restart servlet containers multiple times without * restarting JVM. */ public static void cleanUp() { SnappyLoader.cleanUpExtractedNativeLib(); SnappyLoader.setSnappyApi(null); }
public void stop(BundleContext context) throws Exception { SnappyLoader.setSnappyApi(null); SnappyLoader.cleanUpExtractedNativeLib(); } }
/** * Make a call to {@link System#loadLibrary(String)} to load the native library which assumes * that the library is available on the path based on this {@link Bundle}'s {@link Manifest}. */ public void start(BundleContext context) throws Exception { String library = System.mapLibraryName(LIBRARY_NAME); if (library.toLowerCase().endsWith(".dylib")) { // some MacOS JDK7+ vendors map to dylib instead of jnilib library = library.replace(".dylib", ".jnilib"); } System.loadLibrary(library); SnappyLoader.setSnappyApi(new SnappyNative()); }
static synchronized SnappyNative loadSnappyApi() { if (snappyApi != null) { return snappyApi; } loadNativeLibrary(); setSnappyApi(new SnappyNative()); return snappyApi; }