Changed NativeLibraryLocator to make extraction code multi-process safe.

This commit is contained in:
Adam Murdoch
2012-10-07 06:55:03 +10:00
parent bc84bb102b
commit fbf246dbf9
5 changed files with 76 additions and 22 deletions

View File

@@ -19,22 +19,17 @@ public class Native {
private Native() {
}
/**
* Returns the version of the native library implementations used by this class.
*/
@ThreadSafe
static public String getNativeVersion() {
return String.valueOf(NativeLibraryFunctions.VERSION);
}
/**
* Initialises the native integration, if not already initialized.
*
* @param extractDir The directory to extract native resources into. May be null, in which case a default is
* selected.
*
* @throws NativeIntegrationUnavailableException When native integration is not available on the current machine.
* @throws NativeException On failure to load the native integration.
*/
@ThreadSafe
static public void init(File extractDir) {
static public void init(File extractDir) throws NativeIntegrationUnavailableException, NativeException {
synchronized (Native.class) {
if (!loaded) {
Platform platform = Platform.current();