making the native method public and renaming to gather

This commit is contained in:
Doug MacEachern 2004-11-21 19:11:55 +00:00
parent 9616fb7f39
commit 14f2e8811f
5 changed files with 15 additions and 15 deletions

View File

@ -1062,7 +1062,7 @@ while (my($name, $fields) = each %classes) {
$sigar_function = $func_alias{$sigar_function} || $sigar_function; $sigar_function = $func_alias{$sigar_function} || $sigar_function;
my $sigar_type = join '_', $sigar_prefix, 't'; my $sigar_type = join '_', $sigar_prefix, 't';
my $nativefunc = join '_', $jni_prefix, 'nativeGet'; my $nativefunc = join '_', $jni_prefix, 'gather';
my $proto = join "\n", my $proto = join "\n",
"JNIEXPORT void JNICALL $nativefunc", "JNIEXPORT void JNICALL $nativefunc",
@ -1121,9 +1121,9 @@ package net.hyperic.sigar;
*/ */
public class $name { public class $name {
$name() { } public $name() { }
native void nativeGet($jargs_proto) throws SigarException; public native void gather($jargs_proto) throws SigarException;
/** /**
* This method is not intended to be called directly. * This method is not intended to be called directly.
@ -1133,7 +1133,7 @@ public class $name {
*/ */
static $name fetch($jargs_proto) throws SigarException { static $name fetch($jargs_proto) throws SigarException {
$name $jname = new $name(); $name $jname = new $name();
$jname.nativeGet($jargs); $jname.gather($jargs);
return $jname; return $jname;
} }

View File

@ -746,10 +746,10 @@ JNIEXPORT jint SIGAR_JNI(FileInfo_getMode)
/* /*
* copy of the generated FileAttrs_nativeGet function * copy of the generated FileAttrs_gather function
* but we call the lstat wrapper instead. * but we call the lstat wrapper instead.
*/ */
JNIEXPORT void SIGAR_JNI(FileInfo_nativeGetLink) JNIEXPORT void SIGAR_JNI(FileInfo_gatherLink)
(JNIEnv *env, jobject obj, jobject sigar_obj, jstring name) (JNIEnv *env, jobject obj, jobject sigar_obj, jstring name)
{ {
sigar_file_attrs_t s; sigar_file_attrs_t s;

View File

@ -91,7 +91,7 @@ public class FileInfo extends FileAttrs {
private static native String getTypeString(int type); private static native String getTypeString(int type);
native void nativeGetLink(Sigar sigar, String name) native void gatherLink(Sigar sigar, String name)
throws SigarException; throws SigarException;
public String getTypeString() { public String getTypeString() {
@ -160,7 +160,7 @@ public class FileInfo extends FileAttrs {
this.stat = this.sigar.getDirStat(this.name); this.stat = this.sigar.getDirStat(this.name);
} }
else { else {
this.stat.nativeGet(this.sigar, this.name); this.stat.gather(this.sigar, this.name);
} }
} catch (SigarException e) { } catch (SigarException e) {
//ok for now //ok for now
@ -381,16 +381,16 @@ public class FileInfo extends FileAttrs {
long mtime = this.mtime; long mtime = this.mtime;
if (this.lstat) { if (this.lstat) {
this.nativeGetLink(this.sigar, this.name); this.gatherLink(this.sigar, this.name);
} }
else { else {
this.nativeGet(this.sigar, this.name); this.gather(this.sigar, this.name);
} }
if (this.dirStatEnabled && if (this.dirStatEnabled &&
(mtime != this.mtime)) //no need to fetch stat if unmodified. (mtime != this.mtime)) //no need to fetch stat if unmodified.
{ {
this.stat.nativeGet(this.sigar, this.name); this.stat.gather(this.sigar, this.name);
} }
} }
@ -401,11 +401,11 @@ public class FileInfo extends FileAttrs {
FileInfo info = new FileInfo(); FileInfo info = new FileInfo();
if (followSymlinks) { if (followSymlinks) {
info.nativeGet(sigar, name); info.gather(sigar, name);
info.lstat = false; info.lstat = false;
} }
else { else {
info.nativeGetLink(sigar, name); info.gatherLink(sigar, name);
info.lstat = true; info.lstat = true;
} }

View File

@ -17,7 +17,7 @@ public class ProcCpu extends ProcTime {
private void getValues(Sigar sigar, long pid) private void getValues(Sigar sigar, long pid)
throws SigarException { throws SigarException {
this.nativeGet(sigar, pid); this.gather(sigar, pid);
} }
static synchronized ProcCpu get(Sigar sigar, long pid) static synchronized ProcCpu get(Sigar sigar, long pid)

View File

@ -10,7 +10,7 @@ public class ThreadCpuTime extends ThreadCpu {
} }
public void getCurrent() throws SigarException { public void getCurrent() throws SigarException {
this.nativeGet(this.sigar, 0); this.gather(this.sigar, 0);
} }
public ThreadCpu getDiff() throws SigarException { public ThreadCpu getDiff() throws SigarException {