add static helper getNativeLibraryName

This commit is contained in:
Doug MacEachern 2004-07-28 14:57:49 +00:00
parent 73b6f54d7e
commit d98ddc9ac5
1 changed files with 18 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import net.hyperic.jni.ArchNotSupportedException;
public class SigarLoader extends ArchLoader {
private static String location = null;
private static String nativeName = null;
public SigarLoader(Class loaderClass) {
super(loaderClass);
@ -52,4 +53,21 @@ public class SigarLoader extends ArchLoader {
}
return location;
}
/**
* Returns the name of the native sigar library.
*/
public synchronized static String getNativeLibraryName() {
if (nativeName == null) {
SigarLoader loader = new SigarLoader(Sigar.class);
try {
nativeName = loader.getLibraryName();
} catch (ArchNotSupportedException e) {
nativeName = null;
}
}
return nativeName;
}
}