change getFileSystemList to update the FileSystemMap

This commit is contained in:
Doug MacEachern 2005-05-08 17:33:42 +00:00
parent f0f5c5646a
commit df43f0d115
2 changed files with 12 additions and 3 deletions

View File

@ -268,7 +268,7 @@ enum {
#define STRING_SIG "Ljava/lang/String;" #define STRING_SIG "Ljava/lang/String;"
JNIEXPORT jobjectArray SIGAR_JNI(Sigar_getFileSystemList) JNIEXPORT jobjectArray SIGAR_JNI(Sigar_getFileSystemListNative)
(JNIEnv *env, jobject sigar_obj) (JNIEnv *env, jobject sigar_obj)
{ {
int status; int status;

View File

@ -489,11 +489,20 @@ public class Sigar implements SigarProxy {
return ThreadCpu.fetch(this, 0); return ThreadCpu.fetch(this, 0);
} }
private native FileSystem[] getFileSystemListNative() throws SigarException;
/** /**
* Get list of file systems. * Get list of file systems.
* @exception SigarException on failure. * @exception SigarException on failure.
*/ */
public native FileSystem[] getFileSystemList() throws SigarException; public FileSystem[] getFileSystemList() throws SigarException {
FileSystem[] fslist = getFileSystemListNative();
if (this.mounts != null) {
this.mounts.init(fslist);
}
return fslist;
}
/** /**
* Get file system usage. * Get file system usage.
@ -547,7 +556,7 @@ public class Sigar implements SigarProxy {
this.mounts = new FileSystemMap(); this.mounts = new FileSystemMap();
} }
this.mounts.init(getFileSystemList()); getFileSystemList(); //this.mounts.init()
return this.mounts; return this.mounts;
} }