move proxy usage to ProcessFinder

This commit is contained in:
Doug MacEachern 2007-04-21 23:56:43 +00:00
parent 8c102842b7
commit 10d50d8916
2 changed files with 6 additions and 20 deletions

View File

@ -34,9 +34,10 @@ public class ProcessFinder {
this.proxy.getPid();
}
/**
* @deprecated
*/
private Sigar getSigar() {
return SigarProxyCache.getSigar(this.proxy);
}
public long findSingleProcess(String query)
throws SigarException, SigarNotImplementedException {
@ -49,15 +50,12 @@ public class ProcessFinder {
}
}
/**
* @deprecated
*/
public long findSingleProcess(ProcessQuery query)
throws SigarException, SigarNotImplementedException,
MalformedQueryException {
if (query instanceof SigarProcessQuery) {
return ((SigarProcessQuery)query).findProcess(this.proxy);
return ((SigarProcessQuery)query).findProcess(getSigar());
}
throw new SigarNotImplementedException();
@ -98,7 +96,7 @@ public class ProcessFinder {
throws SigarException, SigarNotImplementedException {
if (query instanceof SigarProcessQuery) {
return ((SigarProcessQuery)query).findProcesses(this.proxy);
return ((SigarProcessQuery)query).findProcesses(getSigar());
}
throw new SigarNotImplementedException();

View File

@ -49,21 +49,9 @@ public class SigarProcessQuery implements ProcessQuery {
public native long findProcess(Sigar sigar)
throws SigarException, SigarNotImplementedException, MalformedQueryException;
public long findProcess(SigarProxy sigar)
throws SigarException, SigarNotImplementedException, MalformedQueryException {
return findProcess(SigarProxyCache.getSigar(sigar));
}
public native long[] findProcesses(Sigar sigar)
throws SigarException, SigarNotImplementedException;
public long[] findProcesses(SigarProxy sigar)
throws SigarException, SigarNotImplementedException {
return findProcesses(SigarProxyCache.getSigar(sigar));
}
static boolean re(String haystack, String needle) {
if (haystack == null) {
return false;