Sigar.getProc*(String) methods now convert PTQL queries

This commit is contained in:
Doug MacEachern 2006-08-24 22:49:26 +00:00
parent 5c33239e82
commit 4b5a270033
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2006-08-24 Doug MacEachern <dougm@hyperic.com>
* Sigar.getProc*(String) methods now convert PTQL queries
2006-08-04 Doug MacEachern <dougm@hyperic.com> 2006-08-04 Doug MacEachern <dougm@hyperic.com>
* Port hpux impl to ia64 arch * Port hpux impl to ia64 arch

View File

@ -30,6 +30,8 @@ import java.util.StringTokenizer;
import org.hyperic.jni.ArchLoaderException; import org.hyperic.jni.ArchLoaderException;
import org.hyperic.jni.ArchNotSupportedException; import org.hyperic.jni.ArchNotSupportedException;
import org.hyperic.sigar.ptql.ProcessFinder;
/** /**
* The Sigar class provides access to the sigar objects containing * The Sigar class provides access to the sigar objects containing
* system information. The Sigar object itself maintains internal * system information. The Sigar object itself maintains internal
@ -78,6 +80,8 @@ public class Sigar implements SigarProxy {
private Cpu lastCpu; private Cpu lastCpu;
private Cpu[] lastCpuList; private Cpu[] lastCpuList;
private ProcessFinder processFinder = null;
static { static {
String nativeVersion = "unknown"; String nativeVersion = "unknown";
String nativeBuildDate = "unknown"; String nativeBuildDate = "unknown";
@ -365,9 +369,17 @@ public class Sigar implements SigarProxy {
if (pid.equals("$$")) { if (pid.equals("$$")) {
return getPid(); return getPid();
} }
else if (Character.isDigit(pid.charAt(0))) {
return Long.parseLong(pid); return Long.parseLong(pid);
} }
else {
if (this.processFinder == null) {
this.processFinder = new ProcessFinder(this);
}
return this.processFinder.findSingleProcess(pid);
}
}
/** /**
* Get process memory info. * Get process memory info.