ProcessQueryFactory does not use the SigarProxy object
This commit is contained in:
parent
bd6184ae67
commit
9ffbe0fa34
|
@ -74,7 +74,7 @@ public class ProcessFinder {
|
||||||
ProcessFinder finder = new ProcessFinder(sigar);
|
ProcessFinder finder = new ProcessFinder(sigar);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return finder.find(ProcessQueryFactory.getInstance(query, sigar));
|
return finder.find(ProcessQueryFactory.getInstance(query));
|
||||||
} catch (QueryLoadException e) {
|
} catch (QueryLoadException e) {
|
||||||
throw new SigarException(e.getMessage());
|
throw new SigarException(e.getMessage());
|
||||||
} catch (MalformedQueryException e) {
|
} catch (MalformedQueryException e) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Comparator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import net.hyperic.sigar.SigarProxy;
|
|
||||||
import net.hyperic.sigar.util.ReferenceMap;
|
import net.hyperic.sigar.util.ReferenceMap;
|
||||||
|
|
||||||
public class ProcessQueryFactory implements Comparator {
|
public class ProcessQueryFactory implements Comparator {
|
||||||
|
@ -13,14 +12,8 @@ public class ProcessQueryFactory implements Comparator {
|
||||||
private static Map cache =
|
private static Map cache =
|
||||||
ReferenceMap.synchronizedMap();
|
ReferenceMap.synchronizedMap();
|
||||||
|
|
||||||
private SigarProxy sigar = null;
|
|
||||||
|
|
||||||
public ProcessQueryFactory() {}
|
public ProcessQueryFactory() {}
|
||||||
|
|
||||||
public ProcessQueryFactory(SigarProxy sigar) {
|
|
||||||
this.sigar = sigar;
|
|
||||||
}
|
|
||||||
|
|
||||||
//sort what will become instruction branches.
|
//sort what will become instruction branches.
|
||||||
//so the cheapest are executed first.
|
//so the cheapest are executed first.
|
||||||
private int getOrder(String s) {
|
private int getOrder(String s) {
|
||||||
|
@ -127,13 +120,6 @@ public class ProcessQueryFactory implements Comparator {
|
||||||
throws MalformedQueryException,
|
throws MalformedQueryException,
|
||||||
QueryLoadException {
|
QueryLoadException {
|
||||||
|
|
||||||
return getInstance(query, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ProcessQuery getInstance(String query, SigarProxy sigar)
|
|
||||||
throws MalformedQueryException,
|
|
||||||
QueryLoadException {
|
|
||||||
|
|
||||||
if (query == null) {
|
if (query == null) {
|
||||||
throw new MalformedQueryException("null query");
|
throw new MalformedQueryException("null query");
|
||||||
}
|
}
|
||||||
|
@ -165,7 +151,7 @@ public class ProcessQueryFactory implements Comparator {
|
||||||
queries.put(vals[0], vals[1]);
|
queries.put(vals[0], vals[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessQueryFactory factory = new ProcessQueryFactory(sigar);
|
ProcessQueryFactory factory = new ProcessQueryFactory();
|
||||||
|
|
||||||
pQuery = factory.prepare(queries);
|
pQuery = factory.prepare(queries);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue