Created
June 8, 2013 14:40
-
-
Save jsanda/5735367 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SnappyNativeLoader | |
{ | |
private static HashMap<String, Boolean> loadedLibFiles = new HashMap<String, Boolean>(); | |
private static HashMap<String, Boolean> loadedLib = new HashMap<String, Boolean>(); | |
public static synchronized void load(String lib) { | |
if (loadedLibFiles.containsKey(lib) && loadedLibFiles.get(lib) == true) | |
return; | |
try { | |
System.load(lib); | |
loadedLibFiles.put(lib, true); | |
} | |
catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
public static synchronized void loadLibrary(String libname) { | |
if (loadedLib.containsKey(libname) && loadedLib.get(libname) == true) | |
return; | |
try { | |
System.loadLibrary(libname); | |
loadedLib.put(libname, true); | |
} | |
catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment