Skip to content

Instantly share code, notes, and snippets.

@jsanda
Created June 8, 2013 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsanda/5735367 to your computer and use it in GitHub Desktop.
Save jsanda/5735367 to your computer and use it in GitHub Desktop.
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