expose the load method

This commit is contained in:
Doug MacEachern 2005-02-21 01:55:07 +00:00
parent 9cbc2d0e75
commit 074e696438
1 changed files with 10 additions and 2 deletions

View File

@ -19,6 +19,8 @@ import net.hyperic.jni.ArchNotSupportedException;
*/ */
public class Sigar implements SigarProxy { public class Sigar implements SigarProxy {
private static String loadError = null;
public static final long FIELD_NOTIMPL = -1; public static final long FIELD_NOTIMPL = -1;
/** /**
@ -46,7 +48,7 @@ public class Sigar implements SigarProxy {
static { static {
try { try {
load(); loadLibrary();
} catch (SigarException e) { } catch (SigarException e) {
String msg = "Sigar.load: " + e.getMessage(); String msg = "Sigar.load: " + e.getMessage();
try { try {
@ -59,7 +61,13 @@ public class Sigar implements SigarProxy {
} }
} }
private static void load() throws SigarException { public static void load() throws SigarException {
if (loadError != null) {
throw new SigarException(loadError);
}
}
private static void loadLibrary() throws SigarException {
try { try {
if (SigarLoader.IS_WIN32 && if (SigarLoader.IS_WIN32 &&
System.getProperty("os.version").equals("4.0")) System.getProperty("os.version").equals("4.0"))