making the native method public and renaming to gather
This commit is contained in:
parent
9616fb7f39
commit
14f2e8811f
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue